* simulation/news: Change test to make a DATE recognized.
This commit is contained in:
Justin D. Harris 2019-11-20 13:47:18 -05:00 коммит произвёл GitHub
Родитель 99e1441764
Коммит 6543bc62d8
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
7 изменённых файлов: 60 добавлений и 3 удалений

Просмотреть файл

@ -1,7 +1,32 @@
.git/
.vscode/
**/README.md
**/*.Dockerfile
**/Dockerfile
client/build/
# DB
db.sqlite
# Libraries
**/SafeMath.sol
**/SignedSafeMath.sol
blockchain_db/
node_modules/
client/node_modules/
# Generated contract configs
client/src/contracts/*.json
# Training
**/embedding_cache.json
**/*.zip
client/src/ml-models/hot_dog-not/seefood/
client/coverage/
**/*~

2
demo/.gitignore поставляемый
Просмотреть файл

@ -33,7 +33,7 @@ pids
lib-cov
# Coverage directory used by tools like istanbul
coverage
coverage/
# nyc test coverage
.nyc_output

Просмотреть файл

@ -30,6 +30,7 @@
},
"scripts": {
"start": "bash deploy_client.sh",
"start-prod": "bash start_prod.sh",
"build": "react-scripts build",
"test": "bash test.sh",
"train-vpa-classifier": "node src/ml-models/vpa/train-classifier.js",

11
demo/client/start_prod.sh Normal file
Просмотреть файл

@ -0,0 +1,11 @@
#!/bin/bash
# Start the production front-end.
set -ex
if [ -z ${PORT+x} ]; then
PORT=3000
fi
serve --single --listen ${PORT} build

Просмотреть файл

@ -4,11 +4,13 @@
"license": "MIT",
"private": true,
"scripts": {
"blockchain": "mkdir --parents blockchain_db && ganache-cli --db blockchain_db --networkId 5782 --gasLimit 9000000 --gasPrice 1 --host 0.0.0.0 --port 7545 --mnemonic \"net pistol fun vibrant sausage vintage general silk weekend street brave rubber\"",
"blockchain": "mkdir --parents blockchain_db && ganache-cli --db blockchain_db --networkId 5782 --gasLimit 9000000 --gasPrice 1 --host 0.0.0.0 --port ${PORT:-7545} --mnemonic \"net pistol fun vibrant sausage vintage general silk weekend street brave rubber\"",
"clean": "rm -rf blockchain_db db.sqlite client/src/contracts/*.json",
"client": "cd client && yarn start",
"prod-client": "cd client && yarn start-prod",
"lint": "solium --dir client/contracts/ --fix-dry-run",
"server": "nodemon server.js --ignore client/",
"start-prod-back-end": "node server.js",
"test": "cd client && yarn test"
},
"dependencies": {

18
demo/service.Dockerfile Normal file
Просмотреть файл

@ -0,0 +1,18 @@
# For deployment to an Azure Web Service
# Build with: docker image build --file service.Dockerfile --tag decai-demo-prod .
FROM appsvc/node:10-lts
LABEL maintainer="Justin D. Harris (justin.harris@microsoft.com)"
WORKDIR /root/workspace/demo
RUN apt-get update && apt-get install --fix-missing --yes build-essential git locales locales-all
COPY client ./client
COPY package.json server.js setup.sh setup_libs.sh yarn.lock ./
RUN bash setup.sh
# Override the port the blockchain uses (just for this command).
# Test also builds the contracts.
RUN cd client && PORT=7545 yarn test && yarn build

Просмотреть файл

@ -25,6 +25,6 @@ class TestNewsDataLoader(unittest.TestCase):
(x_train, y_train), (x_test, y_test) = self.data_loader.load_data()
def test_entities(self):
doc = self.data_loader._nlp("Today, John Smith walked to a store and bought an apple.")
doc = self.data_loader._nlp("December 25, 2019, John Smith walked to a store and bought an apple.")
actual = self.data_loader._replace_entities(doc)
self.assertEqual("<DATE>, <PERSON> walked to a store and bought an apple.", actual)