Skip to content

Commit

Permalink
move Stanza and Trankit to the models directory
Browse files Browse the repository at this point in the history
  • Loading branch information
aajanki committed Apr 3, 2022
1 parent efafe98 commit 883dd41
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
data/
models/stanza_resources/
models/trankit_resources/
results/
venv/
__pycache__/
Turku-neural-parser-pipeline/
6 changes: 3 additions & 3 deletions download_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
spacy_udpipe.download('fi')

print('Downloading Stanza model...')
os.makedirs('data/stanza_resources', exist_ok=True)
stanza.download('fi', model_dir='data/stanza_resources')
os.makedirs('models/stanza_resources', exist_ok=True)
stanza.download('fi', model_dir='models/stanza_resources')

print('Downloading Trankit model...')
# Initializing the trankit Pipeline will download the models if they are not
# already downloaded
trankit.Pipeline('finnish', cache_dir='data/trankit_resources')
trankit.Pipeline('finnish', cache_dir='models/trankit_resources')

print('Downloading UralicNLP model...')
uralicApi.download("fin")
4 changes: 2 additions & 2 deletions nlpmodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def __init__(self):

def initialize(self):
self.nlp = stanza.Pipeline(lang='fi',
dir='data/stanza_resources',
dir='models/stanza_resources',
processors='tokenize,mwt,pos,lemma')

def parse(self, texts):
Expand Down Expand Up @@ -288,7 +288,7 @@ def __init__(self):
self.nlp = None

def initialize(self):
self.nlp = trankit.Pipeline('finnish', cache_dir='data/trankit_resources')
self.nlp = trankit.Pipeline('finnish', cache_dir='models/trankit_resources')

def parse(self, texts):
res = []
Expand Down

0 comments on commit 883dd41

Please sign in to comment.