Spaces:
Running
Running
Download fn_diff.py from vgotcheva/eloquent-converse: direct link, hf CLI and curl.
- Browser
- Download file 313 Bytes
-
https://huggingface.co/spaces/vgotcheva/eloquent-converse/resolve/main/fn_diff.py
- Command line
-
hf download hf://spaces/vgotcheva/eloquent-converse/fn_diff.py
-
curl -L -o fn_diff.py https://huggingface.co/spaces/vgotcheva/eloquent-converse/resolve/main/fn_diff.py
313 Bytes
| from difflib import Differ | |
| def diff_texts(text1, text2): | |
| d = Differ() | |
| d3= [] | |
| for token in d.compare(text1, text2): | |
| if token[0] != '-': | |
| if token[0] != " ": | |
| d3.append((token[2:], token[0])) | |
| else: | |
| d3.append((token[2:], None)) | |
| return d3 |