Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision |
public:t-malv-15-3:8 [2015/10/08 07:57] – [3. Interactive python script] orvark | public:t-malv-15-3:8 [2024/04/29 13:33] (current) – external edit 127.0.0.1 |
---|
</code> | </code> |
| |
**Note** that ''tree.label()['SEM']'' returns an object of type ''nltk.sem.logic.ApplicationExpression'' (as can be seen by checking its type with ''type()'') and not a string even if you can print it out. To use it in ''evaluate()'' it has to be turned into a string. The simplest way to do that is to use the expression ''"%s" % semantic_representation'' which returns a string. | **Note** that ''tree.label()['SEM']'' returns an object of type ''nltk.sem.logic.ApplicationExpression'' (as can be seen by checking its type with ''type()'') and not a string even though you can print it out. To use it in ''evaluate()'' it has to be turned into a string. The simplest way to do that is to use ''str(semantic_expression)'' or the format operator ''"%s" % semantic_representation'' which return a string. |