Did I find the right examples for you? yes no

All Samples(6)  |  Call(0)  |  Derive(0)  |  Import(6)
str(object='') -> string

Return a nice string representation of the object.
If the argument is a string, the return value is the same object.

src/m/b/MBSP-HEAD/__init__.py   MBSP(Download)
# - relation: for finding subject/object/predicate relations between phrases.
# - preposition: for attaching prepositions to their anchor: "eating with a fork" => eating how? => with a fork.
from config import LEMMA, CHUNK, RELATION, PREPOSITION, ALL
from config import events
from server import active_servers, Server, Servers, TIMBL, MBT
RELATION = config.RELATION    # Verb/argument tags (e.g. sentence subject, sentence object).
ANCHOR   = config.ANCHOR      # The chunk has prepositional noun phrases attached (e.g. eat => with a fork).
LEMMA    = config.LEMMA       # The base form of the word (e.g. mice => mouse).
 
PART_OF_SPEECH = POS # Not used internally because too long.

src/m/b/MBSP-HEAD/tree.py   MBSP(Download)
try:
    from config import SLASH
    from config import WORD, POS, CHUNK, PNP, REL, ANCHOR, LEMMA
    MBSP = True
except:
            elif tag == ANCHOR and ch:
                tags[i] = ch.anchor_id or OUTSIDE
            elif tag == LEMMA:
                tags[i] = encode_entities(self.lemma or "")
            elif tag in self.custom_tags:
              ROLE: None,
            ANCHOR: None,
             LEMMA: None }
        custom = [tag for tag in tags if tag not in p] # Tags for custom parsers, e.g. a SENTIMENT-tag.
        p.update(dict.fromkeys(custom, None))
        for i in range(min(len(token), len(tags))):
            if token[i] != OUTSIDE \
             or tags[i] in (WORD, LEMMA): # In "O is part of the alphabet" => "O" != OUTSIDE.
                p[tags[i]] = decode_entities(token[i])
        # Split I/B prefix from the chunk tag:
        # Return the tags in the same order as the parameters for Sentence.append().
        custom = dict([(tag, p[tag]) for tag in custom])
        return p[WORD], p[LEMMA], p[POS], p[CHUNK], p[ROLE], p[REL], p[PNP], p[ANCHOR], p[IOB], custom
 
    def _parse_relation(self, tag):

src/m/b/MBSP-HEAD/mbsp.py   MBSP(Download)
import prepositions
 
from config import WORD, POS, CHUNK, PNP, REL, ANCHOR, LEMMA
from config import SLASH
 
    if relations : format.append(REL)
    if anchors   : format.append(ANCHOR)
    if lemmata   : format.append(LEMMA)
    # Normalize whitespace.
    s = ' '.join(s.strip().split())
    # Find lemmata.
    if lemmata or anchors:
        f = [WORD, POS, CHUNK, PNP] + (relations and [REL] or []) + [LEMMA]
        s = _lemmatize_merge(s, _lemmatize(_lemmatize_prepare(s)))
        s = _handle_event("on_lemmatize", s, format=f)
    # Find PP anchors.
    if anchors:
        f = [WORD, POS, CHUNK, PNP] + (relations and [REL] or []) + [LEMMA, ANCHOR]
    def filter(self, word=None, tag=None, chunk=None, relation=None, anchor=None, lemma=None):
        """ Returns a list of tokens that match the given tags.
            For example, TokenList.filter(tag="NN*") returns all the nouns in the text.
        """
        m = ((WORD,word), (POS,tag), (CHUNK,chunk), (REL,relation), (ANCHOR,anchor), (LEMMA,lemma))

src/p/a/pattern-2.6/pattern/text/tree.py   Pattern(Download)
try:
    from config import SLASH
    from config import WORD, POS, CHUNK, PNP, REL, ANCHOR, LEMMA
    MBSP = True # Memory-Based Shallow Parser for Python.
except:
            elif tag == ANCHOR and ch:
                tags[i] = ch.anchor_id or OUTSIDE
            elif tag == LEMMA:
                tags[i] = encode_entities(self.lemma or "")
            elif tag in self.custom_tags:
              ROLE: None,
            ANCHOR: None,
             LEMMA: None }
        # Split the slash-formatted token into separate tags in the given order.
        # Decode &slash; characters (usually in words and lemmata).
            if k not in p:
                custom[k] = None
            if v != OUTSIDE or k == WORD or k == LEMMA: # "type O negative" => "O" != OUTSIDE.
                (p if k not in custom else custom)[k] = v
        # Split IOB-prefix from the chunk tag:
        self._previous = p
        # Return the tags in the right order for Sentence.append().
        return p[WORD], p[LEMMA], p[POS], p[CHUNK], p[ROLE], p[REL], p[PNP], p[ANCHOR], p[IOB], custom
 
    def _parse_relation(self, tag):

src/p/a/pattern-HEAD/pattern/text/tree.py   pattern(Download)
try:
    from config import SLASH
    from config import WORD, POS, CHUNK, PNP, REL, ANCHOR, LEMMA
    MBSP = True # Memory-Based Shallow Parser for Python.
except:
            elif tag == ANCHOR and ch:
                tags[i] = ch.anchor_id or OUTSIDE
            elif tag == LEMMA:
                tags[i] = encode_entities(self.lemma or "")
            elif tag in self.custom_tags:
              ROLE: None,
            ANCHOR: None,
             LEMMA: None }
        # Split the slash-formatted token into separate tags in the given order.
        # Decode &slash; characters (usually in words and lemmata).
            if k not in p:
                custom[k] = None
            if v != OUTSIDE or k == WORD or k == LEMMA: # "type O negative" => "O" != OUTSIDE.
                (p if k not in custom else custom)[k] = v
        # Split IOB-prefix from the chunk tag:
        self._previous = p
        # Return the tags in the right order for Sentence.append().
        return p[WORD], p[LEMMA], p[POS], p[CHUNK], p[ROLE], p[REL], p[PNP], p[ANCHOR], p[IOB], custom
 
    def _parse_relation(self, tag):

src/m/b/MBSP-HEAD/prepositions/classify.py   MBSP(Download)
    # We will end up here if mbsp.py is called directly from the command line
    import config
    from config import WORD, POS, CHUNK, PNP, REL, ANCHOR, LEMMA
    from client import batch, TimblPP
    from tree   import Sentence