something working

This commit is contained in:
Evgeniy A. Dushistov
2016-07-03 16:56:30 +03:00
parent 4921f2837a
commit 5b26d06493
15 changed files with 7060732 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
//g++ `pkg-config --cflags glib-2.0` call_stardict_strcmp.cpp `pkg-config --libs glib-2.0`
#include <glib.h>
#include <locale.h>
#include <cstdlib>
#include <cstring>
#include <iostream>
static inline gint stardict_strcmp(const gchar *s1, const gchar *s2)
{
const gint a = g_ascii_strcasecmp(s1, s2);
if (a == 0)
return strcmp(s1, s2);
else
return a;
}
int main()
{
setlocale(LC_ALL, "");
std::cin.sync_with_stdio(false);
std::string line1, line2;
while (std::getline(std::cin, line1) &&
std::getline(std::cin, line2)) {
std::cout << stardict_strcmp(line1.c_str(), line2.c_str()) << "\n";
}
return EXIT_SUCCESS;
}

42
tests/generate_strings_pairs.py Executable file
View File

@@ -0,0 +1,42 @@
#!/usr/bin/env python3
import random, sys
fname = "/home/evgeniy/projects/competitions/words/data/words.txt"
with open(fname, "r") as fin:
words = sorted(set([word.strip() for word in fin.readlines()]))
res = []
for i in range(0, len(words)):
max_idx = len(words) - 1
idx1 = random.randint(0, max_idx)
idx2 = random.randint(0, max_idx)
res.append((words[idx1], words[idx2]))
letters = "abcdefghijklmnopqrstuvwxyzабвгдеёжзийклмнопрстуфкцчщьъэюя"
letters += letters.upper()
letters += " \t!@#$%^&*()[]"
def gen_word(req_word_len):
max_idx = len(letters) - 1
res = ""
for i in range(0, req_word_len):
res += letters[random.randint(0, max_idx)]
return res
for i in range(0, 10000):
l1 = random.randint(1, 100)
l2 = random.randint(1, 100)
res.append((gen_word(l1), gen_word(l2)))
for i in range(0, 10000):
l1 = random.randint(1, 100)
res.append((gen_word(l1), gen_word(l1)))
for item in res:
print(item[0])
print(item[1])

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,10 @@
#!/usr/bin/env python3
import sys
with open(sys.argv[1], "r") as f:
with open(sys.argv[2], "w") as out:
words = set([word.strip() for word in f.readlines()])
for word in words:
out.write(word + "\n")
out.write(word + "\n")

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,7 @@
StarDict's dict ifo file
version=2.4.2
wordcount=1671704
idxfilesize=30235592
bookname=
date=2016.06.18
sametypesequence=x

3343408
tests/words_dic/words.dummy Normal file

File diff suppressed because it is too large Load Diff