Skip to content

Agregar script para crear dict.txt #1059

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 3, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use pathlib instead of os and glob
  • Loading branch information
cmaureir committed Oct 11, 2020
commit 9fa6389b54301de84d2b6f694af222290afe7222
6 changes: 2 additions & 4 deletions scripts/create_dict.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import glob
import os
import sys
from pathlib import Path

"""
Script to generate the 'dict.txt' dictionary based
Expand All @@ -17,7 +15,7 @@
entries = set()

# Read custom dictionaries
for filename in glob.glob(os.path.join("dictionaries", "*.txt")):
for filename in Path("dictionaries").glob("*.txt"):
with open(filename, "r") as f:
lines = [i.rstrip() for i in f.readlines()]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Que te parece hacerlo case insensitive?
y hacer

lines = [i.rstrip().lower() for i in f.readlines()]

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lo habíamos discutido antes de implementar lo de dictionaries/ pero al final el tema fue que si algo decía por ejemplo la the PythonClassImportantBla y alguien lo deja como la pythonclassimportantbla no iba a dejar un error, entonces lo mismo ocurre cuando algo que comienza despues de un punto o un párrafo.

if lines:
Expand Down