Skip to content

Commit bb57113

Browse files
committed
Fix usage of catalogue class to global instance
1 parent 20988b9 commit bb57113

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

camel_tools/disambig/bert/__init__.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
from camel_tools.morphology.database import MorphologyDB
3737
from camel_tools.morphology.analyzer import Analyzer
3838

39-
from camel_tools.data import Catalogue
39+
from camel_tools.data import CATALOGUE
4040
from camel_tools.disambig.common import Disambiguator, DisambiguatedWord
4141
from camel_tools.disambig.common import ScoredAnalysis
4242

@@ -107,15 +107,14 @@ def __init__(self, model_path, analyzer,
107107
self._mle = _read_json(f'{model_path}/mle_model.json')
108108

109109
@staticmethod
110-
def pretrained(model_name=None, top=1, use_gpu=True, batch_size=32,
110+
def pretrained(model_name='msa', top=1, use_gpu=True, batch_size=32,
111111
cache_size=10000):
112112
"""Load a pre-trained model provided with camel_tools.
113113
114114
Args:
115115
model_name (:obj:`str`, optional): Name of pre-trained model to
116116
load. Three models are available: 'msa', 'egy', and 'glf.
117-
If `None`, the default model ('msa') will be loaded.
118-
Defaults to `None`.
117+
Defaults to `msa`.
119118
top (:obj:`int`, optional): The maximum number of top analyses to
120119
return. Defaults to 1.
121120
use_gpu (:obj:`bool`, optional): The flag to use a GPU or not.
@@ -131,7 +130,7 @@ def pretrained(model_name=None, top=1, use_gpu=True, batch_size=32,
131130
pre-trained model.
132131
"""
133132

134-
model_info = Catalogue.get_dataset('DisambigBertUnfactored',
133+
model_info = CATALOGUE.get_dataset('DisambigBertUnfactored',
135134
model_name)
136135
model_config = _read_json(Path(model_info.path, 'default_config.json'))
137136
model_path = str(model_info.path)
@@ -357,8 +356,8 @@ def tag_sentences(self, sentences, use_analyzer=True):
357356
Defaults to True.
358357
359358
Returns:
360-
:obj:`list` of :obj:`list` of :obj:`dict`: The predicted The list of feature tags
361-
for each word in the given sentences
359+
:obj:`list` of :obj:`list` of :obj:`dict`: The predicted The list
360+
of feature tags for each word in the given sentences
362361
"""
363362

364363
if not use_analyzer:

0 commit comments

Comments
 (0)