@classmethod<EOL><INDENT>def fromstring(cls, s, **kwargs):<DEDENT>
C = cls(**kwargs)<EOL>s = s.strip()<EOL>s = s.strip("<STR_LIT:{}>")<EOL>s = s.strip()<EOL>for i in range(<NUM_LIT:3>):<EOL><INDENT>if s.startswith("<STR_LIT>"):<EOL><INDENT>s = s[<NUM_LIT:1>:  ]; C.first = True<EOL><DEDENT>if s.endswith("<STR_LIT:+>") and not s.endswith("<STR_LIT>"):<EOL><INDENT>s = s[<NUM_LIT:0>:-<NUM_LIT:1>]; C.multiple = True<EOL><DEDENT>if s.endswith("<STR_LIT:?>") and not s.endswith("<STR_LIT>"):<EOL><INDENT>s = s[<NUM_LIT:0>:-<NUM_LIT:1>]; C.optional = True<EOL><DEDENT>if s.startswith("<STR_LIT:(>") and s.endswith("<STR_LIT:)>"):<EOL><INDENT>s = s[<NUM_LIT:1>:-<NUM_LIT:1>]; C.optional = True<EOL><DEDENT>if s.startswith("<STR_LIT:[>") and s.endswith("<STR_LIT:]>"):<EOL><INDENT>s = s[<NUM_LIT:1>:-<NUM_LIT:1>]<EOL><DEDENT><DEDENT>s = re.sub(r"<STR_LIT>", "<STR_LIT>", s)<EOL>s = re.sub(r"<STR_LIT>", "<STR_LIT:+>", s)<EOL>s = s.replace("<STR_LIT>", "<STR_LIT>")<EOL>s = s.replace("<STR_LIT:_>","<STR_LIT:U+0020>")<EOL>s = s.replace("<STR_LIT>", "<STR_LIT:_>")<EOL>s = s.replace("<STR_LIT>", "<STR_LIT:(>")<EOL>s = s.replace("<STR_LIT>", "<STR_LIT:)>")<EOL>s = s.replace("<STR_LIT>", "<STR_LIT:[>")<EOL>s = s.replace("<STR_LIT>", "<STR_LIT:]>")<EOL>s = s.replace("<STR_LIT>", "<STR_LIT:{>")<EOL>s = s.replace("<STR_LIT>", "<STR_LIT:}>")<EOL>s = s.replace("<STR_LIT>", "<STR_LIT:(>")<EOL>s = s.replace("<STR_LIT>", "<STR_LIT:)>") <EOL>s = s.replace("<STR_LIT>", "<STR_LIT:[>")<EOL>s = s.replace("<STR_LIT>", "<STR_LIT:]>") <EOL>s = s.replace("<STR_LIT>", "<STR_LIT:{>")<EOL>s = s.replace("<STR_LIT>", "<STR_LIT:}>") <EOL>s = s.replace("<STR_LIT>", "<STR_LIT:*>")<EOL>s = s.replace("<STR_LIT>", "<STR_LIT:?>")    <EOL>s = s.replace("<STR_LIT>", "<STR_LIT:+>")<EOL>s = s.replace("<STR_LIT>", "<STR_LIT>")<EOL>s = s.replace("<STR_LIT>", "<STR_LIT>")<EOL>s = s.split("<STR_LIT:|>")<EOL>s = [v.replace("<STR_LIT>", "<STR_LIT:|>").strip() for v in s]<EOL>for v in s:<EOL><INDENT>C._append(v)<EOL><DEDENT>return C<EOL>
Returns a new Constraint from the given string.
            Uppercase words indicate either a tag ("NN", "JJ", "VP")
            or a taxonomy term (e.g., "PRODUCT", "PERSON").
            Syntax:
            ( defines an optional constraint, e.g., "(JJ)".
            [ defines a constraint with spaces, e.g., "[Mac OS X | Windows Vista]".
            _ is converted to spaces, e.g., "Windows_Vista".
            | separates different options, e.g., "ADJP|ADVP".
            ! can be used as a word prefix to disallow it.
            * can be used as a wildcard character, e.g., "soft*|JJ*".
            ? as a suffix defines a constraint that is optional, e.g., "JJ?".
            + as a suffix defines a constraint that can span multiple words, e.g., "JJ+".
            ^ as a prefix defines a constraint that can only match the first word.
            These characters need to be escaped if used as content: "\(".