-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
45 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,45 @@ | ||
# CHAFile | ||
CLAN's CHA file parser for Python | ||
# CHA file parser for Python | ||
|
||
Class for parsing [CLAN's](http://dali.talkbank.org/clan/) CHA file. | ||
|
||
## Features | ||
* Utterances as a list of strings | ||
* MOR tier as objects | ||
* Easily add more custom tiers | ||
* Count nouns | ||
* Count verbs (spanish only) | ||
|
||
## Usage | ||
|
||
Make a symlink (ln -s) to CLAN's bin directory called "clanBin". | ||
|
||
### Import | ||
```python | ||
import sys | ||
sys.path.insert(0, '<path_to_cloned_repo>') | ||
|
||
import ChaFile | ||
``` | ||
|
||
### Instance | ||
|
||
```python | ||
cha = ChaFile.ChaFile(<path_to_cha_file>) | ||
``` | ||
Options | ||
|
||
```python | ||
cha = ChaFile.ChaFile(<path_to_cha_file>, <list_of_ignored_speakers> = [ SPEAKER_SILENCE ], <list_of_tiers> = [ TIER_MOR ], CDS_ONLY = False ) | ||
``` | ||
### Get utterances | ||
```python | ||
lines = cha.getLines() | ||
``` | ||
Each line is an object with: | ||
* LINE_UTTERANCE : The text of the utterance | ||
* LINE_NUMBER | ||
* LINE_SPEAKER | ||
* LINE_ADDRESSEE | ||
* LINE_BULLET : Timestamp | ||
* TIER_MOR : A list of objects with MOR data: MOR_UNIT_LEXEMA and MOR_UNIT_CATEGORIA | ||
* ... any other tier you selected when instanced |