How to use the rnnmorph.predictor.RNNMorphPredictor function in rnnmorph

To help you get started, we’ve selected a few rnnmorph examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github IlyaGusev / rnnmorph / rnnmorph / test_predictor.py View on Github external
def setUpClass(cls):
        logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
        nltk.download("wordnet")
        nltk.download('averaged_perceptron_tagger')
        nltk.download('universal_tagset')
        cls.en_predictor = RNNMorphPredictor(language="en")
        cls.ru_predictor = RNNMorphPredictor(language="ru")
github IlyaGusev / rnnmorph / rnnmorph / test_predictor.py View on Github external
def setUpClass(cls):
        logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
        nltk.download("wordnet")
        nltk.download('averaged_perceptron_tagger')
        nltk.download('universal_tagset')
        cls.en_predictor = RNNMorphPredictor(language="en")
        cls.ru_predictor = RNNMorphPredictor(language="ru")
github nsu-ai / russian_g2p / other_scripts / check_accentor.py View on Github external
def main():
    if sys.argv.__len__() > 1:
        init_dir_name = os.path.normpath(sys.argv[1])
        assert os.path.isdir(init_dir_name), 'Directory `{0}` does not exist!'.format(init_dir_name)
        all_prompts = sorted(list(get_all_prompts(init_dir_name)))
        accentor = Accentor()
        morpho_predictor = RNNMorphPredictor()
        i = 0
        for cur_prompt in all_prompts[:100]:
            trouble = False
            unknown_words = []
            for cur_subsentence in select_subsentences(cur_prompt):
                morphotags = ['{0} {1}'.format(cur_morpho.pos, cur_morpho.tag)
                              for cur_morpho in morpho_predictor.predict_sentence_tags(cur_subsentence)]
                accent_variants = accentor.do_accents(cur_subsentence, morphotags)
                if len(accent_variants) > 1:
                    trouble = True
                else:
                    accented_phrase = accent_variants[0]
                    for cur_word in accented_phrase:
                        vowels_counter = 0
                        for cur_char in cur_word.lower():
                            if cur_char in VOWEL_LETTERS:
github nsu-ai / russian_g2p / russian_g2p / Preprocessor.py View on Github external
def __init__(self, batch_size=1):
        self.batch_size = batch_size
        self.predictor = RNNMorphPredictor(language="ru")