added new entries

This commit is contained in:
Trilarion
2019-06-25 14:12:55 +02:00
parent d8009e7809
commit 6017130103
19 changed files with 303 additions and 55 deletions

View File

@ -42,6 +42,7 @@
"https://git.savannah.gnu.org/git/freedink.git",
"https://git.savannah.gnu.org/git/freetype/freetype2-demos.git",
"https://git.savannah.gnu.org/git/freetype/freetype2.git",
"https://git.savannah.gnu.org/git/liquidwar6.git",
"https://git.savannah.gnu.org/git/rpge.git",
"https://git.savannah.nongnu.org/git/lordsawar.git",
"https://git.tukaani.org/xz.git",
@ -97,6 +98,7 @@
"https://github.com/MonoGame/MonoGame.git",
"https://github.com/MovingBlocks/Terasology.git",
"https://github.com/NetHack/NetHack.git",
"https://github.com/Neverball/neverball.git",
"https://github.com/Nop90-Switch/Meritous-Switch.git",
"https://github.com/OGRECave/ogre.git",
"https://github.com/OneSleepyDev/boswars_osd.git",
@ -400,6 +402,7 @@
"https://gitlab.com/osgames/xforceffd.git",
"https://gitlab.com/osgames/zangband.git",
"https://gitlab.com/osgames/zeroballistics.git",
"https://gitlab.com/osslugaru/lugaru.git",
"https://gitlab.com/pingus/pingus.git",
"https://gitlab.com/solarus-games/zsdx.git",
"https://gitlab.com/veloren/veloren.git",

View File

@ -0,0 +1,47 @@
"""
Checks a list of game names (comma separated in text file) if they are already included in the database.
Is fuzzy, i.e. accepts a certain similarity of names.
"""
import json
import re
from difflib import SequenceMatcher
from utils.utils import *
def similarity(a, b):
return SequenceMatcher(None, a, b).ratio()
if __name__ == "__main__":
similarity_threshold = 0.7
root_path = os.path.realpath(os.path.join(os.path.dirname(__file__), os.path.pardir))
# read docs/data.json
data_file = os.path.join(root_path, 'docs', 'data.json')
text = read_text(data_file)
data = json.loads(text)
# extract game names
data = data['data']
data = (x[0] for x in data)
existing_names = list(re.sub(r' \([^)]*\)', '', x) for x in data)
# read names to test
test_file = os.path.join(root_path, 'is_already_included.txt')
text = read_text(test_file)
test_names = text.split(', ')
# loop over all test names
for test_name in test_names:
matches = []
# loop over all existing names
for existing_name in existing_names:
s = similarity(test_name.lower(), existing_name.lower())
if s > similarity_threshold:
matches.append('{} ({:.2f})'.format(existing_name, s))
# were matches found
if matches:
print('{} maybe included in {}'.format(test_name, ', '.join(matches)))
else:
print('{} not included'.format(test_name))