chinesenotes-go

command module
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

README

chinesenotes-go

Go web application for Chinese-English dictionary.

The source of the dictionary data is at https://github.com/alexamies/chinesenotes.com

Clone that repo and copy the words.txt file into the data directory under this project

CNOTES_HOME=../chinesenotes.com
mkdir data
cp $CNOTES_HOME/config.yaml .
cp $CNOTES_HOME/data/words.txt data/.
cp $CNOTES_HOME/data/translation_memory_literary.txt data/.
cp $CNOTES_HOME/data/translation_memory_modern.txt data/.

That is all that is needed for basic word lookup. A database and corpus can be added to enable other features.

Make and Save Go Application Image

The Go app is not needed for chinesenotes.com at the moment but it is use for other sites (eg. hbreader.org).

Build the Docker image for the Go application:

docker build -t cn-app-image .

Run it locally with minimal features (C-E dictionary lookp only) enabled

docker run -it --rm -p 8080:8080 --name cn-app \
  cn-app-image

Test basic lookup with curl

curl http://localhost:8080/find/?query=你好

Run it locally with all features enabled

DBUSER=app_user
DBPASSWORD="***"
DATABASE=cse_dict
docker run -itd --rm -p 8080:8080 --name cn-app --link mariadb \
  -e DBHOST=mariadb \
  -e DBUSER=$DBUSER \
  -e DBPASSWORD=$DBPASSWORD \
  -e DATABASE=$DATABASE \
  -e SENDGRID_API_KEY="$SENDGRID_API_KEY" \
  -e GOOGLE_APPLICATION_CREDENTIALS=/cnotes/credentials.json \
  -e TEXT_BUCKET="$TEXT_BUCKET" \
  --mount type=bind,source="$(pwd)",target=/cnotes \
  cn-app-image

Debug

docker exec -it cn-app bash 

Push to Google Container Registry

docker tag cn-app-image gcr.io/$PROJECT/cn-app-image:$TAG
docker -- push gcr.io/$PROJECT/cn-app-image:$TAG

Documentation

Overview

Web application for finding documents in the corpus

Directories

Path Synopsis
Application logging functions
Application logging functions
Package for command line tool configuration
Package for command line tool configuration
Chinese-English dictionary database functions Package for looking up words and multiword expressions.
Chinese-English dictionary database functions Package for looking up words and multiword expressions.
Chinese-English dictionary type definitions
Chinese-English dictionary type definitions
Chinese-English dictionary database functions
Chinese-English dictionary database functions
Functions for finding collections by partial match on collection title Functions for parsing a search query
Functions for finding collections by partial match on collection title Functions for parsing a search query
Package for working with the plain, full text of corpus documents Functions for retrieving text text matches in parallel from text that are either the file or in a remote object store
Package for working with the plain, full text of corpus documents Functions for retrieving text text matches in parallel from text that are either the file or in a remote object store
Package for media metadata
Package for media metadata
Package for web app configuration
Package for web app configuration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL