lingualabpy 0.0.6__py3-none-any.whl → 0.1.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,59 +1,59 @@
1
- from textgrids import Interval
2
-
3
-
4
- def interval_to_list(interval: Interval) -> list[float]:
5
- """"""
6
- return [interval.xmin, interval.xmax]
7
-
8
-
9
- def is_overlap(interval0: Interval, interval1: Interval) -> bool:
10
- """Check if two intervals overlap"""
11
- return interval0.xmin <= interval1.xmax and interval1.xmin <= interval0.xmax
12
-
13
-
14
- def remove_overlap(interval: Interval, interval_to_remove: Interval) -> list[Interval]:
15
- """"""
16
- # Return interval as a list if there is no overlap
17
- if not is_overlap(interval, interval_to_remove):
18
- return [interval]
19
-
20
- else:
21
- updated_intervals = []
22
-
23
- # If the start of the interval is before the start of the interval to be removed,
24
- # add the non-overlapping part to the result.
25
- if interval.xmin < interval_to_remove.xmin:
26
- updated_intervals.append(
27
- Interval(xmin=interval.xmin, xmax=interval_to_remove.xmin)
28
- )
29
-
30
- # If the end of the interval is after the end of the interval to be removed,
31
- # add the non-overlapping part to the result.
32
- if interval.xmax > interval_to_remove.xmax:
33
- updated_intervals.append(
34
- Interval(xmin=interval_to_remove.xmax, xmax=interval.xmax)
35
- )
36
-
37
- return updated_intervals
38
-
39
-
40
- def intervals_masking(
41
- intervals: list[Interval], intervals_mask: list[Interval]
42
- ) -> list[list[float]]:
43
- """"""
44
- # Each intervals mask will be remove from all the intervals
45
- for interval_to_remove in intervals_mask:
46
- new_intervals = []
47
- for interval in intervals:
48
-
49
- # if the start of the interval is after the end of the mask
50
- # we can just add the interval they are sorted
51
- if interval.xmin > interval_to_remove.xmax:
52
- new_intervals.append(interval)
53
-
54
- else:
55
- new_intervals += remove_overlap(interval, interval_to_remove)
56
-
57
- intervals = new_intervals
58
-
59
- return [interval_to_list(_) for _ in intervals]
1
+ from textgrids import Interval
2
+
3
+
4
+ def interval_to_list(interval: Interval) -> list[float]:
5
+ """"""
6
+ return [interval.xmin, interval.xmax]
7
+
8
+
9
+ def is_overlap(interval0: Interval, interval1: Interval) -> bool:
10
+ """Check if two intervals overlap"""
11
+ return interval0.xmin <= interval1.xmax and interval1.xmin <= interval0.xmax
12
+
13
+
14
+ def remove_overlap(interval: Interval, interval_to_remove: Interval) -> list[Interval]:
15
+ """"""
16
+ # Return interval as a list if there is no overlap
17
+ if not is_overlap(interval, interval_to_remove):
18
+ return [interval]
19
+
20
+ else:
21
+ updated_intervals = []
22
+
23
+ # If the start of the interval is before the start of the interval to be removed,
24
+ # add the non-overlapping part to the result.
25
+ if interval.xmin < interval_to_remove.xmin:
26
+ updated_intervals.append(
27
+ Interval(xmin=interval.xmin, xmax=interval_to_remove.xmin)
28
+ )
29
+
30
+ # If the end of the interval is after the end of the interval to be removed,
31
+ # add the non-overlapping part to the result.
32
+ if interval.xmax > interval_to_remove.xmax:
33
+ updated_intervals.append(
34
+ Interval(xmin=interval_to_remove.xmax, xmax=interval.xmax)
35
+ )
36
+
37
+ return updated_intervals
38
+
39
+
40
+ def intervals_masking(
41
+ intervals: list[Interval], intervals_mask: list[Interval]
42
+ ) -> list[list[float]]:
43
+ """"""
44
+ # Each intervals mask will be remove from all the intervals
45
+ for interval_to_remove in intervals_mask:
46
+ new_intervals = []
47
+ for interval in intervals:
48
+
49
+ # if the start of the interval is after the end of the mask
50
+ # we can just add the interval they are sorted
51
+ if interval.xmin > interval_to_remove.xmax:
52
+ new_intervals.append(interval)
53
+
54
+ else:
55
+ new_intervals += remove_overlap(interval, interval_to_remove)
56
+
57
+ intervals = new_intervals
58
+
59
+ return [interval_to_list(_) for _ in intervals]
@@ -0,0 +1,66 @@
1
+ Metadata-Version: 2.4
2
+ Name: lingualabpy
3
+ Version: 0.1.1
4
+ Summary: Tools and utilities from the LINGUA laboratory
5
+ Project-URL: Documentation, https://github.com/lingualab/lingualabpy
6
+ Project-URL: Source, https://github.com/lingualab/lingualabpy
7
+ Project-URL: Tracker, https://github.com/lingualab/lingualabpy/issues
8
+ Author-email: Christophe Bedetti <christophe.bedetti@umontreal.ca>
9
+ License: MIT License
10
+
11
+ Copyright (c) 2024 Lingua Laboratory
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all
21
+ copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
30
+ License-File: LICENSE
31
+ Classifier: Development Status :: 3 - Alpha
32
+ Classifier: Intended Audience :: Developers
33
+ Classifier: Intended Audience :: Science/Research
34
+ Classifier: License :: OSI Approved :: MIT License
35
+ Classifier: Operating System :: MacOS :: MacOS X
36
+ Classifier: Operating System :: Microsoft :: Windows
37
+ Classifier: Operating System :: POSIX :: Linux
38
+ Classifier: Programming Language :: Python :: 3 :: Only
39
+ Classifier: Programming Language :: Python :: 3.8
40
+ Classifier: Programming Language :: Python :: 3.9
41
+ Classifier: Programming Language :: Python :: 3.10
42
+ Classifier: Programming Language :: Python :: 3.11
43
+ Classifier: Topic :: Scientific/Engineering
44
+ Requires-Python: >=3.8.1
45
+ Requires-Dist: click
46
+ Requires-Dist: matplotlib
47
+ Requires-Dist: nilearn==0.12.1
48
+ Requires-Dist: opencv-python
49
+ Requires-Dist: pandas
50
+ Requires-Dist: praat-parselmouth
51
+ Requires-Dist: praat-textgrids
52
+ Requires-Dist: pydub
53
+ Requires-Dist: python-docx
54
+ Provides-Extra: style
55
+ Requires-Dist: black; extra == 'style'
56
+ Requires-Dist: ruff; extra == 'style'
57
+ Provides-Extra: test
58
+ Requires-Dist: pytest; extra == 'test'
59
+ Requires-Dist: pytest-cov; extra == 'test'
60
+ Description-Content-Type: text/markdown
61
+
62
+ # lingualabpy
63
+
64
+ Tools and utilities from the LINGUA laboratory
65
+
66
+ These tools are used in the pipeline [speechmetryflow](https://github.com/lingualab/speechmetryflow)
@@ -0,0 +1,26 @@
1
+ lingualabpy/__init__.py,sha256=KoUkh_Y5eCEDxIh8SaCL_jht5ebBIv7RuHyU-bu-uXk,685
2
+ lingualabpy/_version.py,sha256=m8HxkqoKGw_wAJtc4ZokpJKNLXqp4zwnNhbnfDtro7w,704
3
+ lingualabpy/io.py,sha256=-UXNXHgjy-W7h2h9fmZTe2glKm6tFNSgjLcGxcrVpEo,1106
4
+ lingualabpy/plot.py,sha256=yfqKpS387u1TQaDINXatJhMr67J-q9k78EKrAnyBHlE,836
5
+ lingualabpy/audio/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ lingualabpy/audio/metrics.py,sha256=mPVLYrwxzbw1s8D_XHm0CHe4hrjhFz1GgUN5dmqoZbk,3417
7
+ lingualabpy/audio/triming.py,sha256=Cz2EpjJO11czyAD-Y6gR2yDv95vIwSY_j8gu0nBheo4,277
8
+ lingualabpy/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ lingualabpy/cli/audio_metrics.py,sha256=p-3UNdg2GNl74A1aMh-iekLRivQ7VphKW5JDJ2ssZ9M,1744
10
+ lingualabpy/cli/audio_triming.py,sha256=dNYFkcq13PNMJ4isdWJ32MBFAEKCXCWPXH_X5iH5eIQ,1518
11
+ lingualabpy/cli/docx2json.py,sha256=6c5CSAS0ru30aLIsD9lRfqiehrTHjmbPb_ICw5pi-6Y,569
12
+ lingualabpy/cli/jsons2csv.py,sha256=ASOHY2GjAn8G_qNyR0ZwQ_81_uakXjhwkCLOGGnLcMw,573
13
+ lingualabpy/cli/plot_sound.py,sha256=DCK31EIN9IpirOw-Cb87k1U79dniFuNT8TWcGUBGh14,1603
14
+ lingualabpy/neuroimaging/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
+ lingualabpy/neuroimaging/hcp_connectome.py,sha256=DM7KjXsnPjrvU0mMs7ys91vXNYDvsBgp8x5zts1_hOo,5129
16
+ lingualabpy/text/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
+ lingualabpy/text/parser.py,sha256=A97YKH3syPrHrNgT7WD4IBsOFuM3IFEArOsyLWdJZeU,878
18
+ lingualabpy/text/textgrid.py,sha256=X4R7gDLIM-xHEtvyqaXY8-72HY4kbpoWMPs2E5eQmhM,1418
19
+ lingualabpy/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
+ lingualabpy/tools/data.py,sha256=qzMHFhUTK59f4me646D6I8VNr0nF5xs53nTXtDCyTeU,1482
21
+ lingualabpy/tools/interval.py,sha256=1wJO7sBB97GWRNvr5FmebOj7K33ZEn-nd2Xy9DY__Fg,2001
22
+ lingualabpy-0.1.1.dist-info/METADATA,sha256=VJtbNEPGWjyX35bJYqXnShIO54Yzw8oSx7DFwDL0_NU,2956
23
+ lingualabpy-0.1.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
24
+ lingualabpy-0.1.1.dist-info/entry_points.txt,sha256=iz_pd8DzlHRCT3x-j0ElQtC-ZrXjMZYCg14hgyRcb84,385
25
+ lingualabpy-0.1.1.dist-info/licenses/LICENSE,sha256=c-I54KLO-TBc3-uz1_w3ru3Mf6RSEHnU5cbiIEuCRzw,1074
26
+ lingualabpy-0.1.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: flit 3.9.0
2
+ Generator: hatchling 1.28.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -0,0 +1,7 @@
1
+ [console_scripts]
2
+ lingualabpy_audio_metrics = lingualabpy.cli.audio_metrics:main
3
+ lingualabpy_audio_triming = lingualabpy.cli.audio_triming:main
4
+ lingualabpy_docx2json = lingualabpy.cli.docx2json:main
5
+ lingualabpy_hcp_connectome = lingualabpy.neuroimaging.hcp_connectome:main
6
+ lingualabpy_jsons2csv = lingualabpy.cli.jsons2csv:main
7
+ lingualabpy_plot_sound = lingualabpy.cli.plot_sound:main
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 Lingua Laboratory
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Lingua Laboratory
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.