File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ def get_corpus_db(url: str) -> requests.Response:
3232 return corpus_db
3333
3434
35- def get_corpus_db_detail (name : str ) -> dict :
35+ def get_corpus_db_detail (name : str , version : str = None ) -> dict :
3636 """
3737 Get details about a corpus, using information from local catalog.
3838
@@ -42,7 +42,10 @@ def get_corpus_db_detail(name: str) -> dict:
4242 """
4343 local_db = TinyDB (corpus_db_path ())
4444 query = Query ()
45- res = local_db .search (query .name == name )
45+ if version is None :
46+ res = local_db .search (query .name == name )
47+ else :
48+ res = local_db .search ((query .name == name ) & (query .version == version ))
4649 local_db .close ()
4750
4851 if res :
@@ -116,7 +119,7 @@ def _update_all():
116119 local_db .close ()
117120
118121
119- def get_corpus_path (name : str ) -> Union [str , None ]:
122+ def get_corpus_path (name : str , version : str = None ) -> Union [str , None ]:
120123 """
121124 Get corpus path.
122125
@@ -165,7 +168,7 @@ def get_corpus_path(name: str) -> Union[str, None]:
165168 _update_all ()
166169
167170 if not corpus_db_detail or not corpus_db_detail .get ("filename" ):
168- download (name )
171+ download (name , version = version )
169172 corpus_db_detail = get_corpus_db_detail (name )
170173
171174 if corpus_db_detail and corpus_db_detail .get ("filename" ):
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ def _pud_tagger():
3939def _lst20_tagger ():
4040 global _LST20_TAGGER
4141 if not _LST20_TAGGER :
42- _LST20_TAGGER = PerceptronTagger (path = get_corpus_path (_LST20_TAGGER_NAME ))
42+ _LST20_TAGGER = PerceptronTagger (path = get_corpus_path (_LST20_TAGGER_NAME , version = "0.2.3" ))
4343 return _LST20_TAGGER
4444
4545
You can’t perform that action at this time.
0 commit comments