Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document parser configuration #477

Closed
jacobtomlinson opened this issue Mar 2, 2018 · 21 comments · Fixed by #502
Closed

Document parser configuration #477

jacobtomlinson opened this issue Mar 2, 2018 · 21 comments · Fixed by #502

Comments

@jacobtomlinson
Copy link
Member

jacobtomlinson commented Mar 2, 2018

The configuration reference currently doesn't have a section on parsers. This should be added.

I also think each parser/matcher section should start with the configuration information for that parser, followed by the usage within a skill.

@TarunRKaushik
Copy link
Contributor

U meant "it does not have a section on parsers"?

@jacobtomlinson
Copy link
Member Author

Yes

@sbeesm
Copy link
Contributor

sbeesm commented Mar 18, 2018

Hello! First time contributor here. Can I work on this one?

@FabioRosado
Copy link
Member

Hello there @sbeesm it would be great if you could work on this issue, please let me know if you need help with anything!

Also, welcome 😀👍

@sbeesm
Copy link
Contributor

sbeesm commented Mar 18, 2018

If I'm not wrong, parsers are being used to analyse the messages that the bot receives and the matcher matches it with the available skills and the bot replies accordingly.
So is the working of a parser needs to be documented?

Very sorry but I am slightly confused about what exactly needs to be done and how to get started.
I've gone through some parsers and matchers code but couldn't really figure out what to do.
Please Help!

@jacobtomlinson
Copy link
Member Author

Hi sbeesm

The configuration reference doesn't have any info on how to configure the parsers. Each parser needs to be added with information on how to configure it.

Also if you look at the documentation for each matcher you'll see that some have a configuration section, some don't. They all need one and it should be at the top too.

@FabioRosado
Copy link
Member

The parsers have all the logic to connect to the NLU parsers network and parse the meaning of the words that a user typed in channel/to opsdroid.

The matchers are used as decorators (check regex parser/matcher) and they are used to trigger the parser that connects to the NLU service.

As for what needs to be done, Jacob beat me to it haha

@sbeesm
Copy link
Contributor

sbeesm commented Mar 19, 2018

Thanks @jacobtomlinson and @FabioRosado for helping me get started. 😀

PR #382 fixes #353 and adds windows support but I still get this error when I try to run opsdroid in windows:

(C:\Anaconda3) C:\Users\HP>opsdroid
INFO opsdroid: ========================================
INFO opsdroid: Started application
INFO opsdroid: ========================================
INFO opsdroid: You can customise your opsdroid by modifying your configuration.yaml
INFO opsdroid: Read more at: http://opsdroid.readthedocs.io/#configuration
INFO opsdroid: Watch the Get Started Videos at: http://bit.ly/2fnC0Fh
INFO opsdroid: Install Opsdroid Desktop at:
https://github.com/opsdroid/opsdroid-desktop/releases
INFO opsdroid: ========================================
WARNING opsdroid.loader: No databases in configuration.This will cause skills which store things inmemory to lose data when opsdroid is restarted.
INFO opsdroid.loader: Cloning hello from remote repository
Traceback (most recent call last):
File "c:\anaconda3\lib\runpy.py", line 193, in run_module_as_main
"main", mod_spec)
File "c:\anaconda3\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Anaconda3\Scripts\opsdroid.exe_main
.py", line 9, in
File "c:\anaconda3\lib\site-packages\opsdroid_main
.py", line 130, in main
opsdroid.start_loop()
File "c:\anaconda3\lib\site-packages\opsdroid\core.py", line 136, in start_loop
self.loader.load_modules_from_config(self.config)
File "c:\anaconda3\lib\site-packages\opsdroid\loader.py", line 257, in load_modules_from_config
skills = self._load_modules('skill', config['skills'])
File "c:\anaconda3\lib\site-packages\opsdroid\loader.py", line 307, in _load_modules
self._install_module(config)
File "c:\anaconda3\lib\site-packages\opsdroid\loader.py", line 336, in _install_module
self._install_git_module(config)
File "c:\anaconda3\lib\site-packages\opsdroid\loader.py", line 386, in _install_git_module
config["branch"])
File "c:\anaconda3\lib\site-packages\opsdroid\loader.py", line 98, in git_clone
stderr=subprocess.PIPE)
File "c:\anaconda3\lib\subprocess.py", line 709, in init
restore_signals, start_new_session)
File "c:\anaconda3\lib\subprocess.py", line 997, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

I have installed it using pip3 in anaconda in my default python 3.6 environment.

@sbeesm
Copy link
Contributor

sbeesm commented Mar 19, 2018

In the test and example_config files, most of the parsers have configurations like name, access-token, min-score.
Are there more configurations as well? If so, where can I find them?

And can u please tell me that how can I find more info on these configurations so that a proper documentation can be prepared. 🙏
Because to be honest I am not really able to understand the concept of parser configs.

@FabioRosado
Copy link
Member

At the moment you have different kinds of parsers in opsdroid:

  • Natural Language Processors
    • Dialogflow
    • Rasa
    • luis.ai
    • recast.ai
    • witai
  • Regex Parser
  • Crontab parser
  • weekhook
  • always

All NLP parsers need to be specified in the file configuration.yaml in order to be used with opsdroid. Some parses take different configuration settings - as example check the Rasa NLU configuration.

As Jacob said the configuration should be at the top of the document because this will be the most important piece of information that someone might need (you will care more about how to activate the parser first than how it works).

I did a quick check and currently these are the parsers that don't have a configuration section:

  • regex
  • always
  • crontab

The things with regex for example is that you don't really need any specific parameter in the configuration.yaml file. Have a look at the configuration example file to have an idea what would be needed to included in each parser configuration section.

Hope this was helpful 👍

@sbeesm
Copy link
Contributor

sbeesm commented Mar 22, 2018

Is this ok?

Configuring opsdroid for Regex Matcher 
parsers:
   - name: regex
     enabled: true

In order to enable regex skills you must set the enabled parameter to true in the parsers section of the opsdroid configuration file.

If a skill is configured with both the regex and some other NLU matcher then users who don't use NLU will get a simple regex match. However users with some other NLU configured will get matches on more flexible messages, but will not see duplicate responses where the regex also matched.
Configuring opsdroid for Crontab Matcher
parsers:
   - name: crontab
     enabled: true

In order to enable crontab skills you must set the enabled paramater to true in the parsers section of the opsdroid configuration file.

@sbeesm
Copy link
Contributor

sbeesm commented Mar 22, 2018

The always matcher parses every message as it is always working/running. So can the always matcher be configured or does it need to be configured?

@FabioRosado
Copy link
Member

Yeah that looks good @sbeesm you can create a PR and start working on there if you wish to do so.
Yes the matcher parser will always match a skill. You can perhaps make a note stating this perhaps? @jacobtomlinson might have an opinion about the always matcher

@sbeesm
Copy link
Contributor

sbeesm commented Mar 22, 2018

Also, all the links to matchers under the 'Matchers available' section in Docs/tutorials/intoduction.md seem to be broken. They are not working.

@FabioRosado
Copy link
Member

What are you using to read the documentation? The links work in the site and on my pycharm :)

@sbeesm
Copy link
Contributor

sbeesm commented Mar 22, 2018

I am using Chrome browser, and this is what it shows:
image

@sbeesm
Copy link
Contributor

sbeesm commented Mar 22, 2018

And shall I add a new Parsers section in the Configuration Reference or just add the missing configurations in their respective matcher docs?

@FabioRosado
Copy link
Member

Is it only the wit.ai not working or all of them?
The configuration should be added to both places

@sbeesm
Copy link
Contributor

sbeesm commented Mar 22, 2018

All of them aren't working.

@jacobtomlinson
Copy link
Member Author

jacobtomlinson commented Mar 23, 2018

Yes the links are not designed to work on the GitHub website, they are designed to work in the mkdocs documentation.

sbeesm added a commit to sbeesm/opsdroid that referenced this issue Mar 24, 2018
(opsdroid#477)

    Adds a parsers section in the configuration reference.
sbeesm added a commit to sbeesm/opsdroid that referenced this issue Mar 24, 2018
    Added/moved the configuration info to the starting of each matcher file.
@sbeesm
Copy link
Contributor

sbeesm commented Mar 24, 2018

I've created a PR #502
Waiting for review!

jacobtomlinson pushed a commit that referenced this issue Mar 24, 2018
* Document parser configuration
(#477)

    Adds a parsers section in the configuration reference.

* Document parser config (#477)
    Added/moved the configuration info to the starting of each matcher file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants