Skip to content

Commit

Permalink
Merge pull request #58 from weaviate/native_build
Browse files Browse the repository at this point in the history
Off by one error in word index
  • Loading branch information
antas-marcin authored Mar 10, 2023
2 parents 8eb65ce + d80dd60 commit 284dbc9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion contextionary/core/wordlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (w *Wordlist) FindIndexByWord(_needle string) ItemIndex {
var bytes_needle = []byte(needle)

var low ItemIndex = 0
var high ItemIndex = ItemIndex(w.numberOfWords)
var high ItemIndex = ItemIndex(w.numberOfWords) - 1

for low <= high {
var midpoint ItemIndex = (low + high) / 2
Expand Down
28 changes: 28 additions & 0 deletions tools/native_build_contextionary.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh

#Download contextionary
LANGUAGE=en
MODEL_VERSION=0.16.0
./tools/download_contextionary.sh "$LANGUAGE" "$MODEL_VERSION"

#Build the server
VERSION=1.2.0
CGO_ENABLED=1 go build -o ./contextionary-server -a -tags netgo -ldflags "-w -X main.Version=$VERSION" ./server

#Generate contextionary
tools/dev/gen_simple_contextionary.sh

#Preprocess splitter dictionary
/bin/bash ./tools/preprocess_splitter_dict.sh "$LANGUAGE" "./data/contextionary.idx"

#Copy files to Alpine image
cp ./contextionary-server $PWD

#Set environment variables
export KNN_FILE=./data/contextionary.knn
export IDX_FILE=./data/contextionary.idx
export STOPWORDS_FILE=./data/stopwords.json
export COMPOUND_SPLITTING_DICTIONARY_FILE=./data/splitter_dict.csv

#Run the server
./contextionary-server

0 comments on commit 284dbc9

Please sign in to comment.