465e3da40350f30c2ef965b72531fb33666fa388,tests/test_extract.py,,test_pos_regex_matches,#Any#,282

Before Change




def test_pos_regex_matches(spacy_doc):
    expected = [
        "Two weeks",
        "Kuwait",
        "an I.M.F. seminar",
        "Arab educators",
        "30 minutes",
        "the impact",
        "technology trends",
        "education",
        "the Middle East",
        "an Egyptian education official",
        "his hand",
        "a personal question",
        "Donald Trump",
        "mosques",
        "the United States",
        "great sorrow",
        "that what",
        "our kids",
    ]
    observed = [
        span.text
        for span in extract.pos_regex_matches(
            spacy_doc, constants.POS_REGEX_PATTERNS["en"]["NP"]

After Change



def test_pos_regex_matches(spacy_doc):
    pattern = constants.POS_REGEX_PATTERNS["en"]["NP"]
    valid_pos = set(re.findall(r"(\w+)", pattern))
    required_pos = {"NOUN", "PROPN"}
    result = list(extract.pos_regex_matches(spacy_doc, pattern))
    assert all(isinstance(span, SpacySpan) for span in result)
    assert all(tok.pos_ in valid_pos for span in result for tok in span)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: chartbeat-labs/textacy
Commit Name: 465e3da40350f30c2ef965b72531fb33666fa388
Time: 2019-03-20
Author: burtdewilde@gmail.com
File Name: tests/test_extract.py
Class Name:
Method Name: test_pos_regex_matches


Project Name: open-mmlab/mmdetection
Commit Name: 2d2e5c6f42b6f4b8ab4f68985b1fd7823e3be505
Time: 2021-01-13
Author: 35596075+congee524@users.noreply.github.com
File Name: docs/stat.py
Class Name:
Method Name:


Project Name: comic/grand-challenge.org
Commit Name: c8f80caf3b3a5707a2d5d2b9dfee1e4e80f1b3be
Time: 2017-05-09
Author: jamesmeakin@gmail.com
File Name: django/comicsite/templatetags/comic_templatetags.py
Class Name: comic_URLNode
Method Name: render


Project Name: nltk/nltk
Commit Name: 5e233859c5fef3c6c5059fe0f8e201b9f67b4e67
Time: 2019-05-07
Author: alvations@gmail.com
File Name: nltk/corpus/reader/wordnet.py
Class Name: WordNetCorpusReader
Method Name: _synset_from_pos_and_line