<commit_before>import numpy as np
import os

def test_spacy():
    import spacy
    from rasa_nlu.featurizers.spacy_featurizer import SpacyFeaturizer
    nlp = spacy.load('en',tagger=False, parser=False)
    sentence =u"hey how are you today"
    doc=nlp(sentence)
    ftr = SpacyFeaturizer(nlp)
    vecs = ftr.create_bow_vecs([sentence])
    assert np.allclose(doc.vector[:5],np.array([-0.19649599,  0.32493639, -0.37408298, -0.10622784,  0.062756]),atol=1e-5)
    assert np.allclose(vecs[0], doc.vector,atol=1e-5)


def test_mitie():
    from rasa_nlu.featurizers.mitie_featurizer import MITIEFeaturizer
    filename = os.environ.get('MITIE_FILE')
    if (filename and os.path.isfile(filename)):
        ftr = MITIEFeaturizer(os.environ.get('MITIE_FILE'))
        sentence = "Hey how are you today"
        vecs = ftr.create_bow_vecs([sentence])
        assert np.allclose(vecs[0][:5],np.array([ 0.        , -4.4551446 ,  0.26073121, -1.46632245, -1.84205751]),atol=1e-5)<commit_msg>updated reference vec for spacy featurizer<commit_after>import numpy as np
import os

def test_spacy():
    import spacy
    from rasa_nlu.featurizers.spacy_featurizer import SpacyFeaturizer
    nlp = spacy.load('en',tagger=False, parser=False)
    sentence =u"hey how are you today"
    doc=nlp(sentence)
    ftr = SpacyFeaturizer(nlp)
    vecs = ftr.create_bow_vecs([sentence])
    _ref = np.array([0.02188552,  0.00557156, -0.01211646, -0.00866477,  0.02179166])
    assert np.allclose(doc.vector[:5],_ref,atol=1e-5)
    assert np.allclose(vecs[0], doc.vector,atol=1e-5)


def test_mitie():
    from rasa_nlu.featurizers.mitie_featurizer import MITIEFeaturizer
    filename = os.environ.get('MITIE_FILE')
    if (filename and os.path.isfile(filename)):
        ftr = MITIEFeaturizer(os.environ.get('MITIE_FILE'))
        sentence = "Hey how are you today"
        vecs = ftr.create_bow_vecs([sentence])
        assert np.allclose(vecs[0][:5],np.array([ 0.        , -4.4551446 ,  0.26073121, -1.46632245, -1.84205751]),atol=1e-5)
{'fraction_non_alphanumeric': 0.1359126984126984, 'fraction_numerical': 0.08928571428571429, 'mean_word_length': 3.7570754716981134, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7528023', 'n_tokens_mistral': 884, 'n_tokens_neox': 791, 'n_words': 138}