Skip to content

SunnyWay/question_to_statement

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Introduction

This repo provides a Python class POSTree which could convert a question into statement. POSTree takes the parse tree from Stanford Parser as input and produces a statement as output based on some heuristic rules.

Usage

from POSTree import POSTree

tree = POSTree("(ROOT"
               "  (SQ (VBZ Is)"
               "    (NP (DT the) (NN boy))"
               "    (VP (VBG holding)"
               "      (NP (DT a) (NN toy)))"
               "    (. ?)))")
print(tree.adjust_order())
# the boy is **blank** holding a toy

More examples:

what is the boy holding ? --> the boy holding is **blank**

who is holding a toy ? --> **blank** is holding a toy

what is on the table ? --> **blank** is on the table

There is a online Stanford Parser where you can conveniently abtain the parse tree of a sentence.

About

Convert questions into statements based on parse tree.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages