Beispiel #1
0
 def __init__(self, name, path):
     super().__init__()
     self.name = name
     self.path = path
     self.dictionary = Dictionary()
     self.readedWords = []
     self.totalWords = 0
Beispiel #2
0
def create_dictionary(entries, dataset):
    dictionary = Dictionary()
    for ent in entries:
        if dataset == 'vqd':
            qs = ent['question']
        else:
            qs = ent['sentence']['sent']
        dictionary.tokenize(qs, True)
    return dictionary
Beispiel #3
0
    def __init__(self, name, path, type):
        super().__init__()
        self.name = name
        self.path = path
        self.type = type

        self.dictionary = Dictionary()
        self.documents = []

        self.totalCountedWords = 0
def create_dictionary(ds):
    dictionary = Dictionary()
    entries = []   
    for group in ['train','test']:        
        with open( dataset[ds][group],'rb') as f:
            d = pickle.load(f)
            entries.extend(d)
    for ent in entries:
        qs = ent['question']
        dictionary.tokenize(qs, True)
    return dictionary
Beispiel #5
0
    def post(self):
        parser = reqparse.RequestParser()
        parser.add_argument('name', required=True)
        args = parser.parse_args()
        dictionary = Dictionary(args['name'])

        session.session.add(dictionary)
        session.session.commit()
        return {
            'message': 'Success',
            'result': {}
        }, 201, {
            'Location': '/dictionary/:' + str(dictionary.id)
        }