« Back Issue #263
  • 2015-12-18 05:28 Reported by niravkumar
  • 2016-12-15 14:57 Marked fixed
Status: Marked fixed
Priority: Medium

Adding Question Answering System

niravkumar 2015-12-18 05:28

Need to add Question Answering System in order to get the exact answers for the questions.

niravkumar 2015-12-18 17:28

Please review attached patch.

administrator 2015-12-20 10:28

hi nirav,

you didn't add the patch here or put me on this issues watchlist. Please upload your patch to the issue so I can review it.

Best, Chris

niravkumar 2015-12-20 20:30

Hi Professor,

I have attached the patch. I had already attached it but some how not able to see it, so attaching it again. Please review it.

administrator 2015-12-26 18:03

Hey Nirav,

I am just getting around to testing your patch. It seems to depend on lexicon.txt? Can you add that file to this issue?

Happy Holidays, Chrirs

niravkumar 2015-12-27 13:26

Hey Professor,

I have added the required file. Please let me know if you face any issues ahead.

Happy Holidays, Nirav

administrator 2015-12-27 13:30

Hey Nirav,

You should also post it to your class page and say where it comes from. Where does it come from?

Best, Chris

administrator 2015-12-27 15:33

Hey Nirav,

Please don't delete stuff (patches, files, etc you add to an issue). Here are my comments on your last patch.

1. Don't use array( ...) use [] instead.

2. Avoid string manipulation functions which don't work on unicode, use the mb_ functions instead.

3. The TripletExtractor class needs a plain English, informative class level docblock that explain what its purpose is.

4. The TripletExtractor class can't be language specific. Any language specific functionalty has to go into that language's Tokenizer.php file. If your partOfSpeechTager is better than the current English one then replace the English Tokenizer.php with your code. Leave lexicon.txt.gz as a compressed .txt.gz file, but let me know if the current version of the file needs to be replaced. The questionParser method should take the locale. Your code should not depend on whether the language in question is SVO, SOV, VSO, VOS, OVS, OSV). You can add a method to getSentenceStructure($lang) to PhraseParser (which might in turn call the languages Tokenizer.php) to determine this. Replace "WHO", "WHEN", "WHERE" in questionParser with a method call like PhraseParser::getWhoWord($lang).

5. Any text that is output by SearchView needs to be localizable.

6. Remove any slow, wasteful code. For example, you have a code block where you compute trim($question_string_tagged[$index]['tag']) a whole bunch of times i.e.,

               "VBD" == trim($question_string_tagged[$index]['tag']) ||

+ "VBG" == trim($question_string_tagged[$index]['tag']) || + "VBN" == trim($question_string_tagged[$index]['tag']) || + "VBP" == trim($question_string_tagged[$index]['tag']) || + "VBZ" == trim($question_string_tagged[$index]['tag']))) { Assign this expression to a variable and use that variable.

Best, Chris

niravkumar 2015-12-27 15:50

Hi Professor,

Thank you for the feedback. I will work on it and update you.

administrator 2016-02-06 09:56

Hey Nirav,

Are you still interested in working to get your patch applied or have you moved on?

Best, Chris

administrator 2016-05-19 11:07

Hey Nirav,

Just checking as I haven't heard from you in a while. Are you still working on this or should I close this issue as unfixed?

Best, Chris

niravkumar 2016-05-22 17:19

Hi Professor,

I haven't got a chance to work on it, you can close is as unfix as of now. Having said that, I am still interested working on the patch, but do not want you to wait on it. I will update you once I am done with the patch, but you can close the issue as unfixed so that you do not have to follow up with it.

Sorry for the trouble professor.

administrator 2016-05-30 13:06

Hey Nirav,

I'm planning my summer coding. I think your project is important so I'm leaving it open and will try to modify your existing patch some time this summer.

Best, Chris

salilshenoy 2016-10-22 15:48

Hi Professor,

I have uploaded a copy of the patch Question_Answer_Patch.patch.

Could you please let me know your comments.

Thank You, Salil

salilshenoy 2016-11-02 22:53

Hi Professor,

I have uploaded a copy of the patch Question_Answer_Patch.patch. Changes include 1. Wrapping up code lines greater than 80 columns 2. Renamed functions to make it follow the coding conventions

  IsNullOrEmptyString to isNullOrEmptyString
  partOfSpeechTagger_Brill to partOfSpeechTaggerBrill

3. Used a variable for some expressions to avoid repeatation of code.

I have tested the patch locally and it is working. Please let me know your review comments.

Thank You, Salil

administrator 2016-11-13 18:07

Hey Salil, (Nirav too if you are still following),

The initial question answer code is now in the git repository. It has been substantially reworked from Salil's last patch. Salil please make sure to get hte change before you try to get localization to work. There is now a flag in the config file that can turn on and off the qa system: ENABLE_QUESTION_ANSWERING. The got also checks if the locale has a methods tagTokenizePartOfSpeech and isQuestion before even trying to use the QA system. I've added timing code to see how long the qa system takes. It is currently about 3-4 times slower than the rest of the page processing. The kind of questions that it can handle (simple wh) is also limited and can be improved as this project continues.

salilshenoy 2016-12-11 15:52

Hi Professor,

I have uploaded the patch containing the Rule Based Hindi Part of Speech Tagger. The files affected are

1. Tokenizer.php under the 'hi' folder in locale
2. Added a Hindi lexicon (which I will continue to work on improving)

Please let me know your comments.

Thank You, Salil

salilshenoy 2016-12-13 11:36

Hello Professor,

I have uploaded the patch containing the refactored code for English Question Answering System. The changes include:

 1. Removed the QuestionAnswerExtractor.php file
 2. Moved all the code to Tokenizer.php
 3. PhraseModel.php
 4. PhraseParser.php

I have tested this on my local instance of Yioop. The triplets are being formed as earlier and also questions entered in yioop are answered.

Please let me know your comments.

Thank You, Salil

administrator 2016-12-15 14:56

Thanks for the patches, Salil. They've been applied. Let's start a new issue for the new year.

Best, Chris

X