Showing posts with label OpenCog. Show all posts
Showing posts with label OpenCog. Show all posts

Monday, September 19, 2011

A new design to Frame2Relex Component of OpenCog

Input

Set of frames.

Onetime steps (should be done beforehand and serialize)
Step 1

Extract all unique frame templates from mapping rules (RelEx2Frame) file.

Eg: ^1_Arriving:Manner($Arriving,$var0)

Step 2 – Frame-Rule Bitmap

Create a bitmap for each frame template (of step 1 list) whose length is the number of rules (RelEx2Frame), where each bit corresponds to a unique rule i.e. if the ith frame template is present in the jth rule, the jth bit of the ith bitmap is set to 1.

Step 3 – Rule-Frame Bitmap

Create a bitmap for each rule (RelEx2Frame) whose length is the number of frame templates, where each bit corresponds to a unique frame template i.e. if the ith frame template is present in the jth rule, the ith bit of the jth bitmap is set to 1.

Step 4

Serialize all bitmaps.

Algorithm

Step 1

De-serialize all bitmaps.

Step 2

For each frame in the input: (eg: ^1_Entity:Entity(John,John) )

    Find the matching frame templates. (i.e. ^1_Entity:Entity($var0,$var0) )
  
Step 3

Perform 'OR' operation on Frame-Rule bitmaps of matching frame templates to obtain the Frame-Rule bitmap which corresponds to the possible rules that the input frames represent. Thus, we obtain a subset of rules using the positions that are true.

Step 4

All the rules obtained from step 3 are not necessarily the rules that are valid, since in some rules there are multiple frames as consequent. Thus, we perform a check on the subset of rules obtained from step 3, using the Rule-Frame bitmaps.

For each rule in the subset of rules:
    We check whether all its consequent frame templates are present in the frame templates correspond to input frames.

From this step we obtain a subset of rules (i.e. all necessary rules) of rules obtained at step 3.

Step 5

For each necessary rule:
    Using corresponding actual frames we map variables (eg: $var0, $Time) of this rule.
    We take its conditional part and remove all the 'NOT' true relations and 'OR' relations (ideally we should not remove 'OR' conditions, but handling this is tough/impossible?). Thus we take only the standalone 'TRUE' relations and 'TRUE' relations joined with an 'AND'. Note these are relation templates (eg: _subj($var0,$var1) ).
    We substitute values of variables in relation templates and obtain the actual relex relations.


That's it! :) Of course this will not provide all the relex relations that are needed to form a sentence, due to the limitations in existing RelEx2Frame rules.

Test case:

Input:

^1_Entity:Entity(John,John)

^1_Being_named:Entity(John)

^1_Transitive_action:Agent(throw,John)

^1_Cause_motion:Agent(throw,John)

^1_Cause_motion:Theme(throw,ball)

^1_Transitive_action:Patient(throw,ball)


Output:


noun(John)

_subj(throw,John)

_obj(throw,ball)

person(John)

Saturday, October 2, 2010

Inception of an exciting time!



Ok, now I'm in my final year as an undergraduate, and this post is all about the 10 credits worth final year project of me. We've formed our group when we were in training, and my group mates are Nisansa de Silva, Chamilka Wijeratne and Danaja Maldeniya. Further this post carries what I did in first two or so weeks since the start of the semester.

During this period we went across an exciting time with the selection of a project idea and analysing the feasibility of ideas for a final year project in the area we are most interested i.e. Artificial Intelligence. We had few interesting ideas, some are posted in Moodle, and some ideas came up from my group mates. We had met with the lecturers and got to know about their expectations etc. about those ideas. But we decided to explore few ideas which are more interesting to us.


While I was thinking about a project idea, suddenly I remembered about an AI related open source project which I got familiar with during GSoC-2010, that is OpenCog. OpenCog is an open source Artificial General Intelligence framework, intended to one day express general intelligence at the human level and beyond. I did surf about OpenCog to get more familiar with it. Meanwhile I sent an email to the co-founder of OpenCog Dr. Ben Goertzel (CEO of Novamente LLC and Biomind LLC, CTO of Genescient Corp., Chairman of Humanity+, Advisor in Singularity University and Singularity Institute, Adjunct Professor of Cognitive Science, Xiamen University, China) and Dr. Joel Pitt who is a developer in OpenCog, by mentioning our interest to work under OpenCog and inquiring him possible project ideas with good research value. I got a really quick response from Dr. Ben with four possible categories namely NLP, machine learning, virtual embodiment and cognition, including brief descriptions. I shared Dr. Ben’s reply with my project members and went on a process of selecting the most interesting and doable two categories. We were able to select two categories i.e. NLP and machine learning and requested Dr. Ben to give us more detailed descriptions, at the same time I introduced other members of my team to Dr. Ben.

Dr. Ben was on a trip for couple of days, so we were asked to wait till he is back at home. Meanwhile I did few readings on OpenCog, NLGen and RelEx. On 26th I had a chat in gTalk with Dr. Ben and got to know that machine learning involves pretty hard core C++ programming including lots of templates and use of STL and Boost, since most of us were not familiar with C++, he suggested us to do a project in NLP which is more java based. Dr. Ben suggested three possible project ideas with brief descriptions on each, all were really interesting. After discussing with Vishaka Madam and Dr. Shehan we all agreed to do the project which is involved in improving the RelEx2Frame rule engine, which is used to identify the semantic relationships in English sentences. Dr. Shehan extended his support as our internal supervisor, while Dr. Ben Goertzel will support us as an external supervisor.

Dr. Ben provided us with the list of tasks that would be possible to do under the selected project, which will help us to come up with a comprehensive project proposal. Last few days I had looked into RelEx and RelEx2Frame, and tried to set up the environment to use RelEx. Also today I had a useful discussion on #opencog IRC channel with two OpenCog developers including Dr. Joel Pitt, and got very useful information about the project and they asked me to give the details of our group and our university etc. to mention us on the OpenCog Recap which is a fortnightly summary of stuff that is happening in the OpenCog community.

This is how things went since the inception of our project group.