Update modules/syntax_analysis.py
Browse files- modules/syntax_analysis.py +1 -20
modules/syntax_analysis.py
CHANGED
@@ -151,23 +151,4 @@ def visualize_syntax(text, nlp, lang):
|
|
151 |
print(f"Warning: The input text is too long. Only the first {max_tokens} tokens will be visualized.")
|
152 |
return visualize_syntax_graph(doc, lang)
|
153 |
|
154 |
-
|
155 |
-
word_counts = Counter(token.text.lower() for token in doc if token.pos_ != 'PUNCT')
|
156 |
-
repeated_words = {word: count for word, count in word_counts.items() if count > 1}
|
157 |
-
|
158 |
-
word_colors = {}
|
159 |
-
for token in doc:
|
160 |
-
if token.text.lower() in repeated_words:
|
161 |
-
word_colors[token.text.lower()] = POS_COLORS.get(token.pos_, '#FFFFFF')
|
162 |
-
|
163 |
-
return word_colors
|
164 |
-
|
165 |
-
def highlight_repeated_words(doc, word_colors):
|
166 |
-
highlighted_text = []
|
167 |
-
for token in doc:
|
168 |
-
if token.text.lower() in word_colors:
|
169 |
-
color = word_colors[token.text.lower()]
|
170 |
-
highlighted_text.append(f'<span style="background-color: {color};">{token.text}</span>')
|
171 |
-
else:
|
172 |
-
highlighted_text.append(token.text)
|
173 |
-
return ' '.join(highlighted_text)
|
|
|
151 |
print(f"Warning: The input text is too long. Only the first {max_tokens} tokens will be visualized.")
|
152 |
return visualize_syntax_graph(doc, lang)
|
153 |
|
154 |
+
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|