deeppavlov.models.morpho_tagger

class deeppavlov.models.morpho_tagger.tagger.MorphoTaggerWrapper(**kwargs)[source]

Initialize the Model and additional parent classes attributes.

Parameters:**kwargs – a dictionary containing parameters for model and parameters for training it formed from json config file part that correspond to your model.
deeppavlov.models.morpho_tagger.common.predict_with_model(config_path: [<class 'pathlib.Path'>, <class 'str'>]) → List[List[str]][source]

Returns predictions of morphotagging model given in config :config_path:.

Parameters:config_path – a path to config
Returns:a list of morphological analyses for each sentence. Each analysis is either a list of tags or a list of full CONLL-U descriptions.
deeppavlov.models.morpho_tagger.common.prettify(sent: Union[str, typing.List[str]], tags: List[str], return_string: bool = True, begin: str = '', end: str = '', sep: str = '\n') → Union[typing.List[str], str][source]

Prettifies output of morphological tagger.

Parameters:
  • sent – source sentence (either tokenized or not)
  • tags – list of tags, the output of a tagger
  • return_string – whether to return a list of strings or a single string
  • begin – a string to append in the beginning
  • end – a string to append in the end
  • sep – separator between word analyses
Returns:

the prettified output of the tagger.

Examples

>>> sent = "John likes, really likes pizza"
>>> tags = ["NNP", "VBZ", "PUNCT", "RB", "VBZ", "NN"]
>>> prettify(sent, tags)
1  John    NNP
2  likes   VBZ
3  ,   PUNCT
4  really  RB
5  likes   VBZ
6  pizza   NN
7  .    SENT
class deeppavlov.models.morpho_tagger.common.TagOutputPrettifier(return_string: bool = True, begin: str = '', end: str = '', sep: str = 'n')[source]

Wrapper to () function.

Parameters:
  • return_string – whether to return a list of strings or a single string
  • begin – a string to append in the beginning
  • end – a string to append in the end
  • sep – separator between word analyses
__call__(X: List[Union[str, typing.List[str]]], Y: List[Union[str, typing.List[str]]]) → List[Union[str, typing.List[str]]][source]

Calls the prettify function for each input sentence.

Parameters:
  • X – a list of input sentences
  • Y – a list of list of tags for sentence words
Returns:

a list of prettified morphological analyses