Python nltk.compat.python_2_unicode_compatible() Examples

The following are code examples for showing how to use nltk.compat.python_2_unicode_compatible(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

Example 1
Project: razzy-spinner   Author: rafasashi   File: framenet.py    GNU General Public License v3.0 5 votes vote down vote up
def _str(self):
        outstr = ""

        if not '_type' in self:
            outstr = _pretty_any(self)
        elif self['_type'] == 'frame':
            outstr = _pretty_frame(self)
        elif self['_type'] == 'fe':
            outstr = _pretty_fe(self)
        elif self['_type'] == 'lu':
            outstr = _pretty_lu(self)
        elif self['_type'] == 'semtype':
            outstr = _pretty_semtype(self)
        elif self['_type'] == 'framerelationtype':
            outstr = _pretty_frame_relation_type(self)
        elif self['_type'] == 'framerelation':
            outstr = _pretty_frame_relation(self)
        elif self['_type'] == 'ferelation':
            outstr = _pretty_fe_relation(self)
        else:
            outstr = _pretty_any(self)

        # ensure result is unicode string prior to applying the
        # @python_2_unicode_compatible decorator (because non-ASCII characters
        # could in principle occur in the data and would trigger an encoding error when
        # passed as arguments to str.format()).
        # assert isinstance(outstr, unicode) # not in Python 3.2
        return outstr 
Example 2
Project: OpenBottle   Author: xiaozhuchacha   File: framenet.py    MIT License 5 votes vote down vote up
def _str(self):
        outstr = ""

        if not '_type' in self:
            outstr = _pretty_any(self)
        elif self['_type'] == 'frame':
            outstr = _pretty_frame(self)
        elif self['_type'] == 'fe':
            outstr = _pretty_fe(self)
        elif self['_type'] == 'lu':
            outstr = _pretty_lu(self)
        elif self['_type'] == 'luexemplars': # list of ALL exemplars for LU
            outstr = _pretty_exemplars(self, self[0].LU)
        elif self['_type'] == 'fulltext_annotation': # list of all sentences for full-text doc
            outstr = _pretty_fulltext_sentences(self)
        elif self['_type'] == 'lusentence':
            outstr = _pretty_annotation(self)
        elif self['_type'] == 'fulltext_sentence':
            outstr = _pretty_fulltext_sentence(self)
        elif self['_type'] in ('luannotationset', 'fulltext_annotationset'):
            outstr = _pretty_annotation(self, aset_level=True)
        elif self['_type'] == 'posannotationset':
            outstr = _pretty_pos(self)
        elif self['_type'] == 'semtype':
            outstr = _pretty_semtype(self)
        elif self['_type'] == 'framerelationtype':
            outstr = _pretty_frame_relation_type(self)
        elif self['_type'] == 'framerelation':
            outstr = _pretty_frame_relation(self)
        elif self['_type'] == 'ferelation':
            outstr = _pretty_fe_relation(self)
        else:
            outstr = _pretty_any(self)

        # ensure result is unicode string prior to applying the
        # @python_2_unicode_compatible decorator (because non-ASCII characters
        # could in principle occur in the data and would trigger an encoding error when
        # passed as arguments to str.format()).
        # assert isinstance(outstr, unicode) # not in Python 3.2
        return outstr 
Example 3
Project: OpenBottle   Author: xiaozhuchacha   File: framenet.py    MIT License 5 votes vote down vote up
def _str(self):
        outstr = ""

        if not '_type' in self:
            outstr = _pretty_any(self)
        elif self['_type'] == 'frame':
            outstr = _pretty_frame(self)
        elif self['_type'] == 'fe':
            outstr = _pretty_fe(self)
        elif self['_type'] == 'lu':
            outstr = _pretty_lu(self)
        elif self['_type'] == 'luexemplars': # list of ALL exemplars for LU
            outstr = _pretty_exemplars(self, self[0].LU)
        elif self['_type'] == 'fulltext_annotation': # list of all sentences for full-text doc
            outstr = _pretty_fulltext_sentences(self)
        elif self['_type'] == 'lusentence':
            outstr = _pretty_annotation(self)
        elif self['_type'] == 'fulltext_sentence':
            outstr = _pretty_fulltext_sentence(self)
        elif self['_type'] in ('luannotationset', 'fulltext_annotationset'):
            outstr = _pretty_annotation(self, aset_level=True)
        elif self['_type'] == 'posannotationset':
            outstr = _pretty_pos(self)
        elif self['_type'] == 'semtype':
            outstr = _pretty_semtype(self)
        elif self['_type'] == 'framerelationtype':
            outstr = _pretty_frame_relation_type(self)
        elif self['_type'] == 'framerelation':
            outstr = _pretty_frame_relation(self)
        elif self['_type'] == 'ferelation':
            outstr = _pretty_fe_relation(self)
        else:
            outstr = _pretty_any(self)

        # ensure result is unicode string prior to applying the
        # @python_2_unicode_compatible decorator (because non-ASCII characters
        # could in principle occur in the data and would trigger an encoding error when
        # passed as arguments to str.format()).
        # assert isinstance(outstr, unicode) # not in Python 3.2
        return outstr 
Example 4
Project: Health-Checker   Author: KriAga   File: framenet.py    MIT License 5 votes vote down vote up
def _str(self):
        outstr = ""

        if not '_type' in self:
            outstr = _pretty_any(self)
        elif self['_type'] == 'frame':
            outstr = _pretty_frame(self)
        elif self['_type'] == 'fe':
            outstr = _pretty_fe(self)
        elif self['_type'] == 'lu':
            outstr = _pretty_lu(self)
        elif self['_type'] == 'luexemplars': # list of ALL exemplars for LU
            outstr = _pretty_exemplars(self, self[0].LU)
        elif self['_type'] == 'fulltext_annotation': # list of all sentences for full-text doc
            outstr = _pretty_fulltext_sentences(self)
        elif self['_type'] == 'lusentence':
            outstr = _pretty_annotation(self)
        elif self['_type'] == 'fulltext_sentence':
            outstr = _pretty_fulltext_sentence(self)
        elif self['_type'] in ('luannotationset', 'fulltext_annotationset'):
            outstr = _pretty_annotation(self, aset_level=True)
        elif self['_type'] == 'posannotationset':
            outstr = _pretty_pos(self)
        elif self['_type'] == 'semtype':
            outstr = _pretty_semtype(self)
        elif self['_type'] == 'framerelationtype':
            outstr = _pretty_frame_relation_type(self)
        elif self['_type'] == 'framerelation':
            outstr = _pretty_frame_relation(self)
        elif self['_type'] == 'ferelation':
            outstr = _pretty_fe_relation(self)
        else:
            outstr = _pretty_any(self)

        # ensure result is unicode string prior to applying the
        # @python_2_unicode_compatible decorator (because non-ASCII characters
        # could in principle occur in the data and would trigger an encoding error when
        # passed as arguments to str.format()).
        # assert isinstance(outstr, unicode) # not in Python 3.2
        return outstr 
Example 5
Project: FancyWord   Author: EastonLee   File: framenet.py    GNU General Public License v3.0 5 votes vote down vote up
def _str(self):
        outstr = ""

        if not '_type' in self:
            outstr = _pretty_any(self)
        elif self['_type'] == 'frame':
            outstr = _pretty_frame(self)
        elif self['_type'] == 'fe':
            outstr = _pretty_fe(self)
        elif self['_type'] == 'lu':
            outstr = _pretty_lu(self)
        elif self['_type'] == 'semtype':
            outstr = _pretty_semtype(self)
        elif self['_type'] == 'framerelationtype':
            outstr = _pretty_frame_relation_type(self)
        elif self['_type'] == 'framerelation':
            outstr = _pretty_frame_relation(self)
        elif self['_type'] == 'ferelation':
            outstr = _pretty_fe_relation(self)
        else:
            outstr = _pretty_any(self)

        # ensure result is unicode string prior to applying the
        # @python_2_unicode_compatible decorator (because non-ASCII characters
        # could in principle occur in the data and would trigger an encoding error when
        # passed as arguments to str.format()).
        # assert isinstance(outstr, unicode) # not in Python 3.2
        return outstr 
Example 6
Project: honours_project   Author: JFriel   File: framenet.py    GNU General Public License v3.0 5 votes vote down vote up
def _str(self):
        outstr = ""

        if not '_type' in self:
            outstr = _pretty_any(self)
        elif self['_type'] == 'frame':
            outstr = _pretty_frame(self)
        elif self['_type'] == 'fe':
            outstr = _pretty_fe(self)
        elif self['_type'] == 'lu':
            outstr = _pretty_lu(self)
        elif self['_type'] == 'semtype':
            outstr = _pretty_semtype(self)
        elif self['_type'] == 'framerelationtype':
            outstr = _pretty_frame_relation_type(self)
        elif self['_type'] == 'framerelation':
            outstr = _pretty_frame_relation(self)
        elif self['_type'] == 'ferelation':
            outstr = _pretty_fe_relation(self)
        else:
            outstr = _pretty_any(self)

        # ensure result is unicode string prior to applying the
        # @python_2_unicode_compatible decorator (because non-ASCII characters
        # could in principle occur in the data and would trigger an encoding error when
        # passed as arguments to str.format()).
        # assert isinstance(outstr, unicode) # not in Python 3.2
        return outstr 
Example 7
Project: honours_project   Author: JFriel   File: framenet.py    GNU General Public License v3.0 5 votes vote down vote up
def _str(self):
        outstr = ""

        if not '_type' in self:
            outstr = _pretty_any(self)
        elif self['_type'] == 'frame':
            outstr = _pretty_frame(self)
        elif self['_type'] == 'fe':
            outstr = _pretty_fe(self)
        elif self['_type'] == 'lu':
            outstr = _pretty_lu(self)
        elif self['_type'] == 'semtype':
            outstr = _pretty_semtype(self)
        elif self['_type'] == 'framerelationtype':
            outstr = _pretty_frame_relation_type(self)
        elif self['_type'] == 'framerelation':
            outstr = _pretty_frame_relation(self)
        elif self['_type'] == 'ferelation':
            outstr = _pretty_fe_relation(self)
        else:
            outstr = _pretty_any(self)

        # ensure result is unicode string prior to applying the
        # @python_2_unicode_compatible decorator (because non-ASCII characters
        # could in principle occur in the data and would trigger an encoding error when
        # passed as arguments to str.format()).
        # assert isinstance(outstr, unicode) # not in Python 3.2
        return outstr 
Example 8
Project: aop-helpFinder   Author: jecarvaill   File: framenet.py    GNU General Public License v3.0 5 votes vote down vote up
def _str(self):
        outstr = ""

        if not '_type' in self:
            outstr = _pretty_any(self)
        elif self['_type'] == 'frame':
            outstr = _pretty_frame(self)
        elif self['_type'] == 'fe':
            outstr = _pretty_fe(self)
        elif self['_type'] == 'lu':
            outstr = _pretty_lu(self)
        elif self['_type'] == 'luexemplars': # list of ALL exemplars for LU
            outstr = _pretty_exemplars(self, self[0].LU)
        elif self['_type'] == 'fulltext_annotation': # list of all sentences for full-text doc
            outstr = _pretty_fulltext_sentences(self)
        elif self['_type'] == 'lusentence':
            outstr = _pretty_annotation(self)
        elif self['_type'] == 'fulltext_sentence':
            outstr = _pretty_fulltext_sentence(self)
        elif self['_type'] in ('luannotationset', 'fulltext_annotationset'):
            outstr = _pretty_annotation(self, aset_level=True)
        elif self['_type'] == 'posannotationset':
            outstr = _pretty_pos(self)
        elif self['_type'] == 'semtype':
            outstr = _pretty_semtype(self)
        elif self['_type'] == 'framerelationtype':
            outstr = _pretty_frame_relation_type(self)
        elif self['_type'] == 'framerelation':
            outstr = _pretty_frame_relation(self)
        elif self['_type'] == 'ferelation':
            outstr = _pretty_fe_relation(self)
        else:
            outstr = _pretty_any(self)

        # ensure result is unicode string prior to applying the
        # @python_2_unicode_compatible decorator (because non-ASCII characters
        # could in principle occur in the data and would trigger an encoding error when
        # passed as arguments to str.format()).
        # assert isinstance(outstr, unicode) # not in Python 3.2
        return outstr 
Example 9
Project: serverless-chatbots-workshop   Author: datteswararao   File: framenet.py    Apache License 2.0 5 votes vote down vote up
def _str(self):
        outstr = ""

        if not '_type' in self:
            outstr = _pretty_any(self)
        elif self['_type'] == 'frame':
            outstr = _pretty_frame(self)
        elif self['_type'] == 'fe':
            outstr = _pretty_fe(self)
        elif self['_type'] == 'lu':
            outstr = _pretty_lu(self)
        elif self['_type'] == 'semtype':
            outstr = _pretty_semtype(self)
        elif self['_type'] == 'framerelationtype':
            outstr = _pretty_frame_relation_type(self)
        elif self['_type'] == 'framerelation':
            outstr = _pretty_frame_relation(self)
        elif self['_type'] == 'ferelation':
            outstr = _pretty_fe_relation(self)
        else:
            outstr = _pretty_any(self)

        # ensure result is unicode string prior to applying the
        # @python_2_unicode_compatible decorator (because non-ASCII characters
        # could in principle occur in the data and would trigger an encoding error when
        # passed as arguments to str.format()).
        # assert isinstance(outstr, unicode) # not in Python 3.2
        return outstr 
Example 10
Project: serverless-chatbots-workshop   Author: datteswararao   File: framenet.py    Apache License 2.0 5 votes vote down vote up
def _str(self):
        outstr = ""

        if not '_type' in self:
            outstr = _pretty_any(self)
        elif self['_type'] == 'frame':
            outstr = _pretty_frame(self)
        elif self['_type'] == 'fe':
            outstr = _pretty_fe(self)
        elif self['_type'] == 'lu':
            outstr = _pretty_lu(self)
        elif self['_type'] == 'semtype':
            outstr = _pretty_semtype(self)
        elif self['_type'] == 'framerelationtype':
            outstr = _pretty_frame_relation_type(self)
        elif self['_type'] == 'framerelation':
            outstr = _pretty_frame_relation(self)
        elif self['_type'] == 'ferelation':
            outstr = _pretty_fe_relation(self)
        else:
            outstr = _pretty_any(self)

        # ensure result is unicode string prior to applying the
        # @python_2_unicode_compatible decorator (because non-ASCII characters
        # could in principle occur in the data and would trigger an encoding error when
        # passed as arguments to str.format()).
        # assert isinstance(outstr, unicode) # not in Python 3.2
        return outstr