Answer the question
In order to leave comments, you need to log in
How to compare 2 texts and find unique words?
Is there a tool that can compare 2 texts and write out unique words, i.e. that repeat only 1 time?
it is desirable to convert all words to the initial form, but not necessarily
for example
text1: masha ate porridge
text2: masha ate soup
the tool should compare 2 texts and write out the words:
porridge
soup
Answer the question
In order to leave comments, you need to log in
1. You need to break 2 texts into separate words and sort.
2. Search for similar ones in one and the other text, and if there is such, immediately exclude the words of these texts from the two arrays.
3. Remaining in arrays - will be unique ("non-intersecting") for the given two texts.
Similar words (strings) - can be found using a fuzzy search PHP script or try to order the right software for this task from them right away.
In [1]: t1 = "маша ела кашу"
In [2]: t2 = "маша ела суп"
In [3]: set(t1.lower().split()) ^ set(t2.lower().split())
Out[3]: {'кашу', 'суп'}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question