How to use the underthesea.feature_engineering.feature.sent2features function in underthesea

To help you get started, we’ve selected a few underthesea 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 undertheseanlp / underthesea / underthesea / chunking / transformer.py View on Github external
def extract_features(sentence, template):
        return sent2features(sentence, template)
github undertheseanlp / underthesea / underthesea / word_sent_2 / transformer.py View on Github external
def extract_features(sentence, template):
        return sent2features(sentence, template)
github undertheseanlp / underthesea / underthesea / ner / ner_crf.py View on Github external
template2 = [
            "T[-2].lower", "T[-1].lower", "T[0].lower", "T[1].lower",
            "T[2].lower",
            "T[0].istitle", "T[-1].istitle", "T[1].istitle", "T[-2].istitle",
            "T[2].istitle",
            # word unigram and bigram
            "T[-2]", "T[-1]", "T[0]", "T[1]", "T[2]",
            "T[-2,-1]", "T[-1,0]", "T[0,1]", "T[1,2]",
            # pos unigram and bigram
            "T[-2][1]", "T[-1][1]", "T[0][1]", "T[1][1]", "T[2][1]",
            "T[-2,-1][1]", "T[-1,0][1]", "T[0,1][1]", "T[1,2][1]",
            # ner
            "T[-3][3]", "T[-2][3]", "T[-1][3]",
        ]
        sentence = [(token[0], token[1], token[2], "X") for token in sentence]
        return sent2features(sentence, template2)
github undertheseanlp / underthesea / underthesea / word_sent_2 / transformer.py View on Github external
def transform(sentence):
        template = [
            "T[-1].isdigit", "T[0].isdigit", "T[1].isdigit",
            "T[-1].istitle", "T[0].istitle", "T[1].istitle",
            "T[0,1].istitle", "T[0,2].istitle",
            "T[-1].is_in_dict", "T[0].is_in_dict", "T[1].is_in_dict",
            "T[0,1].is_in_dict", "T[0,2].is_in_dict",
            # word unigram and bigram and trigram
            "T[-2]", "T[-1]", "T[0]", "T[1]", "T[2]",
            "T[-2,-1]", "T[-1,0]", "T[0,1]", "T[1,2]",
            "T[-2,0]", "T[-1,1]", "T[0,2]",
            # BI tag
            "T[-2][1]", "T[-1][1]"
        ]
        sentence = [(token, "X") for token in sentence]
        return sent2features(sentence, template)
github undertheseanlp / underthesea / underthesea / chunking / transformer.py View on Github external
def transform(sentence):
        template = [
            "T[-2].lower", "T[-1].lower", "T[0].lower", "T[1].lower", "T[2].lower",
            "T[0].istitle", "T[-1].istitle", "T[1].istitle",
            # word unigram and bigram
            "T[-2]", "T[-1]", "T[0]", "T[1]", "T[2]",
            "T[-2,-1]", "T[-1,0]", "T[0,1]", "T[1,2]",
            # pos unigram and bigram
            "T[-2][1]", "T[-1][1]", "T[0][1]", "T[1][1]", "T[2][1]",
            "T[-2,-1][1]", "T[-1,0][1]", "T[0,1][1]", "T[1,2][1]",
            # chunk
            "T[-3][2]", "T[-2][2]", "T[-1][2]",
        ]
        sentence = [(token[0], token[1], "A") for token in sentence]
        return sent2features(sentence, template)
github undertheseanlp / underthesea / underthesea / ner / ner_crf.py View on Github external
def extract_features(sentence, template):
        return sent2features(sentence, template)