-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from NickleDave/rewrite-transcriber
Rewrite transcriber
- Loading branch information
Showing
13 changed files
with
277 additions
and
445 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
"""module for formats.""" | ||
import sys | ||
import pkg_resources | ||
|
||
_INSTALLED = [] | ||
current_module = sys.modules[__name__] | ||
for entry_point in pkg_resources.iter_entry_points('crowsetta.format'): | ||
setattr(current_module, entry_point.name, entry_point.load()) | ||
_INSTALLED.append(entry_point.name) | ||
|
||
|
||
def show(): | ||
"""shows what vocal annotation formats are currently installed""" | ||
formats_str = ', '.join([format for format in _INSTALLED]) | ||
print( | ||
f'installed vocal annotation formats:\n{formats_str}' | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import typing | ||
|
||
import attr | ||
from attr.validators import instance_of, optional | ||
|
||
|
||
@attr.s | ||
class Meta: | ||
"""class that represents metadata about a vocal annotation format | ||
and functions for working with it using Crowsetta | ||
Attributes | ||
---------- | ||
name : str | ||
name of vocal annotation format. E.g., "textgrid" | ||
ext : str | ||
extension of files associated with format, e.g. "TextGrid" | ||
to_seq : typing.Callable | ||
a function that accepts the name of a file containing | ||
annotations in the format and returns a Sequence or list of | ||
Sequences. Required. | ||
to_csv : typing.Callable | ||
a function that accepts a Sequence or list of Sequences and | ||
saves them as a comma-separated value file. Default is None. | ||
to_format : typing.Callable | ||
a function that accepts a Sequence or list of Sequences and | ||
saves files in the format. Default is None. | ||
module : str | ||
path to module (a .py file) containing functions for working with format, | ||
e.g. 'home/users/me/Documents/code/textgrid/textgrid.py'. | ||
Default is None. Optional; enables format to be loaded without | ||
making it part of a package that adds it as | ||
a 'crowsetta.format' entry point in a setup.py file. | ||
""" | ||
name = attr.ib(validator=instance_of(str)) | ||
ext = attr.ib(validator=instance_of(str)) | ||
to_seq = attr.ib(validator=instance_of(typing.Callable)) | ||
to_csv = attr.ib(validator=optional(instance_of(typing.Callable)), default=None) | ||
to_format = attr.ib(validator=optional(instance_of(typing.Callable)), default=None) | ||
module = attr.ib(validator=optional(instance_of(str)), default=None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.