bug fix
This commit is contained in:
parent
2cd0750d12
commit
103d2eee63
|
@ -8,8 +8,8 @@ from models.provider import Provider
|
|||
from collections import Counter
|
||||
from Ai.llm import ArticleRater
|
||||
|
||||
BAD_WORDS = ["FAKE", "SATIRE", "Fake", "fake"]
|
||||
GOOD_WORDS = ["REAL", "real", "Real"]
|
||||
BAD_WORDS = ["FAKE", "SATIRE", "Fake", "fake", "fake news", "Fake News"]
|
||||
GOOD_WORDS = ["REAL", "real", "Real", "Reale News", "reale", "reale News", "realen"]
|
||||
BAD_COLOR = "#ff8080"
|
||||
GOOD_COLOR = "#80ff8f"
|
||||
WORDS = BAD_WORDS + GOOD_WORDS
|
||||
|
@ -47,7 +47,6 @@ class MainFrameController:
|
|||
|
||||
def press_check_button(self):
|
||||
text_data = self.get_text_data()
|
||||
print(text_data.text)
|
||||
self._predict(text_data)
|
||||
self.frame.output_textbox.configure(state="normal")
|
||||
self.frame.output_textbox.delete("0.0", "end")
|
||||
|
@ -67,24 +66,24 @@ class MainFrameController:
|
|||
|
||||
# Process highlighting when buffer is full
|
||||
if len(highlight_buffer) == 5:
|
||||
self.process_highlighting(highlight_buffer)
|
||||
self._process_highlighting(highlight_buffer)
|
||||
|
||||
# Process any remaining chunks in the buffer
|
||||
if highlight_buffer:
|
||||
self.process_highlighting(highlight_buffer)
|
||||
self._process_highlighting(highlight_buffer)
|
||||
|
||||
self.frame.output_textbox.configure(state="disabled")
|
||||
self.update_provider_list()
|
||||
|
||||
def process_highlighting(self, highlight_buffer):
|
||||
def _process_highlighting(self, highlight_buffer):
|
||||
start_index = self.frame.output_textbox.index(f"end-{sum(len(c) for c in highlight_buffer)}c")
|
||||
end_index = self.frame.output_textbox.index("end")
|
||||
self.highlight_words(start_index, end_index)
|
||||
self._highlight_words(start_index, end_index)
|
||||
|
||||
# Keep overlap of 2 chunks
|
||||
highlight_buffer = deque(list(highlight_buffer)[-2:], maxlen=5)
|
||||
highlight_buffer = deque(list(highlight_buffer)[-3:], maxlen=5)
|
||||
|
||||
def highlight_words(self, start_index, end_index):
|
||||
def _highlight_words(self, start_index, end_index):
|
||||
content = self.frame.output_textbox.get(start_index, end_index)
|
||||
|
||||
for word in WORDS:
|
||||
|
|
|
@ -21,7 +21,7 @@ class TextData:
|
|||
def text_from_url(self)-> bool:
|
||||
if not self.url:
|
||||
print("No url")
|
||||
return True
|
||||
return False
|
||||
|
||||
if not self.text:
|
||||
print("Extrahiere Text von URL...")
|
||||
|
@ -29,7 +29,7 @@ class TextData:
|
|||
self._extractor.fetch_content()
|
||||
self._extractor.extract_text()
|
||||
self.text = self._extractor.get_text()
|
||||
return False
|
||||
return True
|
||||
|
||||
def get_output(self):
|
||||
|
||||
|
|
Loading…
Reference in New Issue