Skip to content

actions-on-google/actionssdk-shiritori-ja-nodejs

Repository files navigation

しりとり AoG サンプルゲーム

設定

  1. Actions on Google」のプロジェクトを作成する。

  2. 「Action package」をアップデートする:

     gactions update --action_package action.json --project PROJECT_NAME
    
  3. edict2の辞書をダウンロードする。

  4. utf-8に変換する:

     iconv -f euc-jp -t utf-8 edict2 -o edict2.utf8
    
  5. 名詞だけをフィルターする:

     cat edict2.utf8 | grep '(n)' > edict2-noun.utf8
    
  6. 「Firebase Database」にアップロードする:

     npm --prefix script/ install
     node scripts/admin.js noun edict2-noun.utf8 /path/to/service-account
     ^C
    
  7. 「Firebase Functions」をデプロイする。

     firebase deploy
    
  8. Cloud Consoleshiritori のRAMを512MBまで上げる。

  9. Actions on Google「Simulator」でロケールを日本語に設定する。

  10. アシスタントアプリをテストしてみる。

     > テスト用アプリにつないで
    

テスト

  1. edict2の辞書をダウンロードする。

  2. utf-8に変換する:

     iconv -f euc-jp -t utf-8 edict2 -o edict2.utf8
    
  3. 名詞だけをフィルターする:

     cat edict2.utf8 | grep '(n)' > edict2-noun.utf8
    
  4. ローカルのコーパスを作成する:

     npm --prefix scripts/ install
     node scripts/admin.js noun edict2-noun.utf8 > functions/shiritori/corpus.json
    
  5. ニットテスト:

     npm --prefix functions/shiritori/ install
     npm --prefix functions/shiritori/ test
    
  6. スナップショットテスト:

     npm --prefix functions/ install
     npm --prefix functions/ test
    
  7. ローカルで起動してテストする:

     npm --prefix functions/shiritori/ install
     node functions/shiritori/main.js
    
しりとり
> りんご
胡麻酢 [ごます]
> すいか
カプリチョーザ [かぷりちょうざ]
> ざるそば
バインミー [ばいんみい]
> いか
カポナータ [かぽなあた]
> たんたんめん
ざんねん。

Contributing

Contributions to this repository are always welcome and highly encouraged.

See CONTRIBUTING.md for more information on how to get started.

License

Copyright (C) 2018 Google Inc.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.