Giter VIP home page Giter VIP logo

patternmatchingqa's Introduction

Pattern Matching QA

This project is a pattern matching question answering script demo, which is simple enough to consider as a baseline approach or a tutorial.

How does it work

  1. Take the sentence from command line
  2. Every word in the sentence will be scanned by a list of EntityKeywordDictionaries and RelationshipKeywordDictionaries, which then triggers the classification strategy to transform it into labels
    • For example, sentence like "What is Amantadine used to treat?" would trigger the Cure keyword (as Relationship) and Drug keyword (as Entity)
    • According to the classification strategy, this sentence will be transformed into a drug_disease relationship label and Amantadine entity label
  3. Since the entity and relationship have been determined, the query will be constructed and send to a database or even a file to get the answer
  4. Prompt the answer back to the command line
sequenceDiagram
    Actor User
    User->>+Chatbot: raw sentence
    Chatbot->>+Classifier: raw sentence
    Classifier->>+RelationshipPicker: raw sentence
    RelationshipPicker-->>-Classifier: relationships
    Classifier->>+EntityPicker: raw sentence
    EntityPicker-->>-Classifier: entities
    Classifier-->>Chatbot: question type (inferred from relationships)
    Classifier-->>-Chatbot: entity dict (entities)
    Chatbot->>+SQLParser: question type and entity dict
    SQLParser-->>-Chatbot: parsed SQL command
    Chatbot->>-User: parsed SQL command
Loading

How to run it

Run python3 .\Chatbot.py in command line only to start the integration test. To start a conversation, you have to add a while loop into the main function of Chatbot.py

Configuration

The way to adapt a specific database

There is no configuration file, any adaption must be done by modifying the Parser.py

The way to add more classification strategies

Add keyword dictionaries manually, then change the process in Classifier.py

patternmatchingqa's People

Contributors

mangopomelo avatar

Stargazers

 avatar  avatar

Watchers

 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.