Skip to content

Commit

Permalink
Merge pull request #21 from letuananh/dev
Browse files Browse the repository at this point in the history
Updated elan API
  • Loading branch information
letuananh committed May 12, 2021
2 parents 70220d3 + 0585d0e commit e289f66
Show file tree
Hide file tree
Showing 5 changed files with 298 additions and 104 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Main functions are:
## Useful Links

- Speach documentation: https://speach.readthedocs.io/
- Soure code: https://github.com/neocl/speach/
- Source code: https://github.com/neocl/speach/

## Installation

Expand Down
4 changes: 2 additions & 2 deletions docs/api_elan.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ For common code samples to processing ELAN, see :ref:`tut_elan` page.
.. automodule:: speach.elan
:members: read_eaf, parse_eaf_stream

.. autoclass:: ELANDoc
.. autoclass:: Doc
:members:
:member-order: groupwise
:exclude-members: read_eaf, parse_eaf_stream

.. autoclass:: ELANTier
.. autoclass:: Tier
:members:
:member-order: groupwise
8 changes: 4 additions & 4 deletions docs/recipe_elan.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Open an ELAN file
>>> from speach import elan
>>> eaf = elan.read_eaf('./data/test.eaf')
>>> eaf
<speach.elan.ELANDoc object at 0x7f67790593d0>
<speach.elan.Doc object at 0x7f67790593d0>

Parse an existing text stream
-----------------------------
Expand All @@ -23,16 +23,16 @@ If you have an input stream ready, you can parse its content with :code:`parse_e
.. code-block:: python
>>> from speach import elan
>>> with open('./data/test.eaf') as eaf_stream:
>>> with open('./data/test.eaf', encoding='utf-8') as eaf_stream:
>>> ... eaf = elan.parse_eaf_stream(eaf_stream)
>>> ...
>>> eaf
<speach.elan.ELANDoc object at 0x7f6778f7a9d0>
<speach.elan.Doc object at 0x7f6778f7a9d0>
Accessing tiers & annotations
-----------------------------

You can loop through all tiers in an ``ELANDoc`` object (i.e. an eaf file)
You can loop through all tiers in an ``Doc`` object (i.e. an eaf file)
and all annotations in each tier using Python's ``for ... in ...`` loops.
For example:

Expand Down

0 comments on commit e289f66

Please sign in to comment.