<commit_before>from __future__ import print_function, division
import numpy as np
from word_level.features.feature_extractor import FeatureExtractor


class TokenCountFeatureExtractor(FeatureExtractor):

    # extract the word2vec features for a window of tokens around the target token
    def get_features(self, context_obj):
        feature_funcs = [self.source_count, self.target_count, self.source_target_ratio]
        return np.array([f(context_obj) for f in feature_funcs])

    def source_count(self, context_obj):
        try:
            return float(len(context_obj['source']))<commit_msg>path was wrong<commit_after>from __future__ import print_function, division
import numpy as np
from marmot.features.feature_extractor import FeatureExtractor


class TokenCountFeatureExtractor(FeatureExtractor):

    # extract the word2vec features for a window of tokens around the target token
    def get_features(self, context_obj):
        feature_funcs = [self.source_count, self.target_count, self.source_target_ratio]
        return np.array([f(context_obj) for f in feature_funcs])

    def source_count(self, context_obj):
        try:
            return float(len(context_obj['source']))
{'fraction_non_alphanumeric': 0.07005838198498748, 'fraction_numerical': 0.0016680567139282735, 'mean_word_length': 4.5813953488372094, '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': '1998893', 'n_tokens_mistral': 333, 'n_tokens_neox': 326, 'n_words': 95}