-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed loading error for customized pipelines + add conllu conversion …
…for trankit outputs
- Loading branch information
Showing
8 changed files
with
211 additions
and
38 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 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,33 @@ | ||
import trankit | ||
|
||
# initialize a trainer for the task | ||
trainer = trankit.TPipeline( | ||
training_config={ | ||
'category': 'customized-ner', # pipeline category | ||
'task': 'ner', # task name | ||
'save_dir': './save_dir', # directory to save the trained model | ||
'train_bio_fpath': './train.bio', # training data in BIO format | ||
'dev_bio_fpath': './dev.bio', # training data in BIO format | ||
'max_epoch': 1 | ||
} | ||
) | ||
|
||
# start training | ||
trainer.train() | ||
|
||
trankit.download_missing_files( | ||
category='customized-ner', | ||
save_dir='./save_dir', | ||
embedding_name='xlm-roberta-base', | ||
language='english' | ||
) | ||
|
||
trankit.verify_customized_pipeline( | ||
category='customized-ner', # pipeline category | ||
save_dir='./save_dir', # directory used for saving models in previous steps | ||
embedding_name='xlm-roberta-base' | ||
) | ||
|
||
p = trankit.Pipeline(lang='customized-ner', cache_dir='./save_dir') | ||
|
||
print(trankit.trankit2conllu(p('I love you more than I can say. Do you know that?'))) |
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 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.