Hi Gleb
What do you think about developing new probe side function enricher -
'nlpcraft:function'?
Base idea of function enricher is search of maximum count of various
functions, with references to another elements.
For example:
Some model has user element 'x:temp' with synonym 'temperature'
So, for sentence 'show me average temperature', token 'average' should
be detected as element 'nlpcraft:function' with type 'avg' and relation
to 'x:temp' element.
1. In general functions can be
- without argument
- with one argument
- with many arguments
(We can start from first two variants - as first step.)
2. Functions with arguments should have references to some another elements
It can be user element or some predefined elements like 'nlp:geo' etc.
Look at supported elements in the documentation.
(I suggest to define table, which describes, which functions can be
related with which elements)
3. How to detect
Example:
- average temperature - ok (element 'x:temp' is after word 'average')
- temperature average - skipped(such functions cannot be after their
references)
- average - skipped (it doesn't have sense without any references)
- average <some free words> temperature - skipped (references should
be after word without such gaps)
- average the temperature - ok (gaps which contain only stopwords are
possible)
4. This enricher should create token with
- name 'nlpcraft:function',
- mandatory String property 'type' (function name),
- optional java.util.List<Integer> property 'indexes', which
- omitted for function without arguments
- has one length list of indexes for function with one argument
("indexes" field name is hardcoded for internal enrichers and used in
some related components)
Maybe some additional optional parameters can be passed.
5. Supported functions kinds can be
- main math
- sql
- etc
(We can start from math and sql functions, and extend supported kinds
on next steps)
6. Look at Limit, Relation and Sort enrichers as examples,
- they have such references to another elements via 'indexes' fields.
- also note please that this enricher also should be called in loop
(like mentioned above) because can have references to nested elements.
- look also please, how stop-words processed in these enrichers.
(if functions with multiple word-names exist, stopwords are suitable
inside these names, like 'X the Y' is ok as 'X Y' , where 'X Y' is
multiple words valid function name)
7. Functions names and all their synonyms (I guess mostly it can be
shortcuts) can be hardcoded.
Look at
org.apache.nlpcraft.server.nlp.enrichers.coordinate.NCCoordinatesEnricher
as example for numeric measures.
What do you think?
I suppose it can be good start for development.
- there are a lot of examples
- such task can help to dip in the project structure.
Please ask questions.
As result I think, we can create ticker with detailed described task.
What is your opinion on this task?
Sergey Kamov
18.05.2020 22:37, Nikita Ivanov пишет:
Gleb Privet,
Per our off-line discussion, I think functional enricher would be really
great problem to tackle. I think Sergey K. will provide more details as he
developed previous versions.
Thank you and thank you for your contribution to the project so far!
--
Nikita Ivanov
On Sun, May 17, 2020 at 12:35 PM Ifropc <[email protected]>
wrote:
Hello everybody!
First of all, thank you for your feedback on my pull request!
During working on my first issue, I was getting to know some high-level
abstractions of Scala implementation. But I would like to dig a little bit
deeper and get more in-depth knowledge of NLPCraft.
Could you recommend some Jira issue which is good for starters?
Thanks,
Gleb.