Giter VIP home page Giter VIP logo

non-deduct's Introduction

帰納法支援アプリケーション

課題番号: 06-04

このアプリケーションは非演繹推論である帰納を支援します。 与えられた入力文を満たす帰納した文を生成し出力します。 現在対応しているデータベースは日本語WordNetのみです。

使いかた

入力文は標準入力であたえ、--max_step引数で何層まで上位語を探索するかをあたえます。

$ cat data/text1.txt
フランス人はチーズを作ります
日本人はラーメンを食べます
$ cat data/text1.txt | python query.py --max_step 3
市民はチーズを作ります
市民はラーメンを食べます
$ cat data/text2.txt
猿は柿をとっていました
赤ずきんは森に向かいました
$ cat data/text2.txt | python query.py --max_step 2
猿は本質をとっていました
赤ずきんは本質に向かいました

セットアップ

  1. 日本語WordNetからsqlite3形式のデータをダウンロードし、wnjpn.dbをコードと同じディレクトリに配置してください。
  2. requirements.txtに記載されているライブラリをインストールしてください。 pip install -r requirements.txt

技術詳細

分かち書きにJanomeを使い、入力文から名詞と認識された語自体と位置を取得します。次に、その語をWordNetで上位語を指定された層数まで探索します。この処理を入力文の数だけ繰り返すと、それぞれの文に、文のなかのそれぞれの名詞とその上位語の集合が求まります。この上位語の集合で共通集合をもとめると、帰納として使える上位語が取得できるので、その上位語を使って差し換えた文を出力します。

現実装の制約と今後

  • 「〜は〜」という日本語の単文のみ対応しています。現状英文は対応していません。 これは日本語の分かち書きを採用しているためで、言語ごとに切り換え英文も使えるようにしたい。
  • 対応する文法のバリエーションを増やし、複雑な文でも受け入れられるようにしたい。 ニ格ヲ格など。

参考

non-deduct's People

Contributors

jbking avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.