public:t-malv-15-3:8
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
public:t-malv-15-3:8 [2015/10/06 12:14] โ created orvark | public:t-malv-15-3:8 [2024/04/29 13:33] (current) โ external edit 127.0.0.1 | ||
---|---|---|---|
Line 4: | Line 4: | ||
If you can't manage to complete a particular problem please hand in your incomplete code -- comment it out if it produces an error. | If you can't manage to complete a particular problem please hand in your incomplete code -- comment it out if it produces an error. | ||
+ | |||
+ | ===== 0. Introduction ===== | ||
+ | |||
+ | Create a short python script that uses the NLTK to evaluate whether a statement given in natural language is True or False for a given model of the world. //You are given complete freedom to choose what this model is like and what sentences your system understands.// | ||
+ | |||
+ | The exercise can be divided into two distinct parts: | ||
+ | - Semantic analysis of the natural language input using a parser and a grammar with semantic attachments, | ||
+ | - Evaluating the FOL representation of the input against a model created to represent a particular state of affairs in the world. | ||
===== 1. Parsing using " | ===== 1. Parsing using " | ||
- | **Semantic analysis of the natural language input using a parser and a grammar with semantic attachments, | + | **Semantic analysis of the natural language input using a parser and a grammar with semantic attachments, |
You can perform syntax-driven semantic analysis of the natural language input sentence (as seen in chapters 18.1 and 18.2 in the text book) by building a NLTK parser from a " | You can perform syntax-driven semantic analysis of the natural language input sentence (as seen in chapters 18.1 and 18.2 in the text book) by building a NLTK parser from a " | ||
- | Building the parser is as simple as calling '' | + | Building the parser is as simple as calling '' |
<code python> | <code python> | ||
Line 19: | Line 27: | ||
>>> | >>> | ||
>>> | >>> | ||
- | ... | + | ... |
all z2.(dog(z2) -> exists z1.(bone(z1) & give(angus, | all z2.(dog(z2) -> exists z1.(bone(z1) & give(angus, | ||
</ | </ | ||
Line 63: | Line 71: | ||
m = nltk.Model(val.domain, | m = nltk.Model(val.domain, | ||
- | m.evaluate(" | + | m.evaluate(" |
</ | </ | ||
Line 70: | Line 78: | ||
===== 3. Interactive python script ===== | ===== 3. Interactive python script ===== | ||
- | Once you have the two parts working you glue them together in a python script. You should allow users to type in sentences and see their truth value printed until they ๔ฐfinally type " | + | Once you have the two parts working you glue them together in a python script. You should allow users to type in sentences and see their truth value printed until they finally type " |
< | < | ||
Line 82: | Line 90: | ||
</ | </ | ||
+ | **Note** that '' |
/var/www/cadia.ru.is/wiki/data/attic/public/t-malv-15-3/8.1444133655.txt.gz ยท Last modified: 2024/04/29 13:32 (external edit)