diff --git a/python/src/ai/network.py b/python/src/ai/network.py index 10d2d31..928ecac 100644 --- a/python/src/ai/network.py +++ b/python/src/ai/network.py @@ -108,7 +108,6 @@ class AI: os.remove(temp) word_list = th.split_words(obj) fits = encoder.fit_transform(word_list) - print(fits) phrases = [] for length in range(1, len(word_list) + 1): for start in range(0, len(word_list)): diff --git a/python/src/ai/phrase.py b/python/src/ai/phrase.py deleted file mode 100644 index a80a325..0000000 --- a/python/src/ai/phrase.py +++ /dev/null @@ -1,102 +0,0 @@ -import json -from src.ai.word import Word, WordType - - -class PhraseType: - TEXT = 0 - TITLE = 1 - HEADER = 2 - MOVEMENT = 3 - INVALID = 99 - - def __init__(self): - self.__id = 0 - self.__description = 'text' - - def get_id(self): - return self.__id - - def get_desc(self): - return self.__description - - def to_json(self): - return self.__id - - def load(self, phrase_id: int): - self.__id = phrase_id - if phrase_id == self.TITLE: - self.__description = 'title' - elif phrase_id == self.HEADER: - self.__description = 'header' - elif phrase_id == self.MOVEMENT: - self.__description = 'movement' - elif phrase_id == self.INVALID: - self.__description = 'invalid' - return self - - -def phrase_factory(phrase: list, phrase_type: int = None, frec: int = 1): - pt = PhraseType() - if phrase_type is not None: - pt.load(phrase_type) - ph = Phrase() - ph.set_phrase(phrase).set_type(pt).add_frec(frec - 1) - return ph - - -class Phrase: - def __init__(self): - self.__phrase = None - self.__type = None - self.__frec = 1 - - def to_json(self): - return { - 'phrase': [w.to_json() for w in self.__phrase], - 'type': self.__type.to_json(), - 'frec': self.__frec - } - - def set_phrase(self, phrase: list): - [self.add_word(w) for w in phrase] - return self - - def get_phrase(self): - return self.__phrase - - def set_type(self, phrase_type: PhraseType): - self.__type = phrase_type - return self - - def get_type(self): - return self.__type - - def add_word(self, word: Word, pos: int = None): - if self.__phrase is None: - self.__phrase = [] - if pos is None: - self.__phrase.append(word) - return self - self.__phrase = self.__phrase[:pos] + [word] + self.__phrase[pos:] - return self - - def add_frec(self, amount: int = 1): - self.__frec += amount - - def match(self, words: list): - if len(words) != len(self.__phrase): - return False - for w in self.__phrase: - if w not in words: - return False - return True - - def __repr__(self): - print(self.__phrase) - return json.dumps({ - 'phrase': [w.to_json() for w in self.get_phrase()], - 'type': self.get_type().get_desc() - }) - - def __len__(self): - return len(self.__phrase) diff --git a/python/src/ai/word.py b/python/src/ai/word.py deleted file mode 100644 index 274670a..0000000 --- a/python/src/ai/word.py +++ /dev/null @@ -1,84 +0,0 @@ -import json - - -class WordType: - STRING = 0 - NUMERIC = 1 - CURRENCY = 2 - DATE = 3 - - def __init__(self): - self.__id = 0 - self.__description = 'string' - - def to_json(self): - return self.__id - - def load(self, word_id: int): - self.__id = word_id - if word_id == self.NUMERIC: - self.__description = 'numeric' - elif word_id == self.CURRENCY: - self.__description = 'currency' - elif word_id == self.DATE: - self.__description = 'data' - return self - - def get_id(self): - return self.__id - - def get_desc(self): - return self.__description - - def __repr__(self): - return { - 'id': self.get_id(), - 'description': self.get_desc() - } - - -def word_factory(word: str, word_type: int = None, frec: int = 1): - wt = WordType() - if word_type is not None: - wt.load(word_type) - w = Word() - w.set_word(word).set_type(wt).add_frec(frec - 1) - return w - - -class Word: - def __init__(self): - self.__word = None - self.__type = None - self.__frec = 1 - - def to_json(self): - return { - 'word': self.__word, - 'type': self.__type.to_json(), - 'frec': self.__frec - } - - def set_word(self, word: str): - self.__word = word - return self - - def get_word(self): - return self.__word - - def set_type(self, word_type: WordType): - self.__type = word_type - return self - - def get_type(self): - return self.__type - - def add_frec(self, amount: int = 1): - self.__frec += amount - return self - - def __repr__(self): - return json.dumps({ - 'word': self.get_word(), - 'type': self.get_type().get_desc() - }) diff --git a/python/src/contabilidad/__pycache__/log.cpython-39.pyc b/python/src/contabilidad/__pycache__/log.cpython-39.pyc deleted file mode 100644 index 36d64f1..0000000 Binary files a/python/src/contabilidad/__pycache__/log.cpython-39.pyc and /dev/null differ