-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from samhaswon/optimization
Majority C rewrite
- Loading branch information
Showing
53 changed files
with
1,671 additions
and
476 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from src.multi_bible_search import BibleSearch | ||
import faulthandler | ||
|
||
|
||
faulthandler.enable() | ||
searcher = BibleSearch() | ||
searcher.load_all() | ||
|
||
|
||
with open("version_keys.txt", "r") as token_file: | ||
tokens = token_file.read().splitlines() | ||
|
||
unique_tokens = [] | ||
|
||
for token in tokens: | ||
unique = 0 | ||
for version in searcher.versions: | ||
result = searcher.search(token, version) | ||
if len(result): | ||
unique += 1 | ||
if unique < 2: | ||
unique_tokens.append(token) | ||
|
||
if len(unique_tokens) == 0: | ||
print("No unique tokens") | ||
else: | ||
print("Unique tokens:\n", ''.join(f"{t}, " for t in unique_tokens)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import bz2 | ||
import json | ||
|
||
with bz2.open(f"../src/multi_bible_search/data/NIV 2011.json.pbz2", "rt", encoding='utf-8') as data_file: | ||
data = json.load(data_file) | ||
|
||
with open("version_keys.txt", "w") as key_file: | ||
keys = list(data.keys()) | ||
keys.sort() | ||
key_file.write(''.join(f"{k}\n" for k in keys)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from src.multi_bible_search import BibleSearch | ||
|
||
token = "jesus wept" | ||
|
||
|
||
searcher = BibleSearch() | ||
searcher.load_all() | ||
|
||
for version in searcher.versions: | ||
result = searcher.search(token, version) | ||
if len(result): | ||
print(f"Version: {version}; Results {result}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
build: | ||
./venv/Scripts/activate | ||
py -m build | ||
|
||
install: | ||
pip install --force-reinstall ./dist/multi_bible_search-1.0.0.tar.gz | ||
install: dist/multi_bible_search-2.0.0.tar.gz | ||
pip install --force-reinstall ./dist/multi_bible_search-2.0.0.tar.gz | ||
copy venv\\Lib\\site-packages\\multi_bible_search\\*.pyd src\\multi_bible_search\\ | ||
|
||
full: build install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,4 @@ inplace = True | |
|
||
[ext_modules] | ||
sources = | ||
ctranslate.c | ||
multi_bible_search.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.