def __call__(self, s, negation=True, **kwargs):
def avg(assessments, weighted=lambda w: <NUM_LIT:1>):<EOL><INDENT>s, n = <NUM_LIT:0>, <NUM_LIT:0><EOL>for words, score in assessments:<EOL><INDENT>w = weighted(words)<EOL>s += w * score<EOL>n += w<EOL><DEDENT>return s / float(n or <NUM_LIT:1>)<EOL><DEDENT>if hasattr(s, "<STR_LIT>"):<EOL><INDENT>a = [(s.synonyms[<NUM_LIT:0>],) + self.synset(s.id, pos=s.pos) + (None,)]<EOL><DEDENT>elif isinstance(s, basestring) and RE_SYNSET.match(s):<EOL><INDENT>a = [(s.synonyms[<NUM_LIT:0>],) + self.synset(s.id, pos=s.pos) + (None,)]<EOL><DEDENT>elif isinstance(s, basestring):<EOL><INDENT>a = self.assessments(((w.lower(), None) for w in "<STR_LIT:U+0020>".join(self.tokenizer(s)).split()), negation)<EOL><DEDENT>elif hasattr(s, "<STR_LIT>"):<EOL><INDENT>a = self.assessments(((w.lemma or w.string.lower(), w.pos[:<NUM_LIT:2>]) for w in chain(*s)), negation)<EOL><DEDENT>elif hasattr(s, "<STR_LIT>"):<EOL><INDENT>a = self.assessments(((w.lemma or w.string.lower(), w.pos[:<NUM_LIT:2>]) for w in s.words), negation)<EOL><DEDENT>elif hasattr(s, "<STR_LIT>"):<EOL><INDENT>a = self.assessments(((s.lemma or s.string.lower(), s.pos[:<NUM_LIT:2>]),), negation)<EOL><DEDENT>elif hasattr(s, "<STR_LIT>"):<EOL><INDENT>a = self.assessments(chain(*(((w, None), (None, None)) for w in s)), negation)<EOL>kwargs.setdefault("<STR_LIT>", lambda w: s.terms[w[<NUM_LIT:0>]])<EOL><DEDENT>elif isinstance(s, dict):<EOL><INDENT>a = self.assessments(chain(*(((w, None), (None, None)) for w in s)), negation)<EOL>kwargs.setdefault("<STR_LIT>", lambda w: s[w[<NUM_LIT:0>]])<EOL><DEDENT>elif isinstance(s, list):<EOL><INDENT>a = self.assessments(((w, None) for w in s), negation)<EOL><DEDENT>else:<EOL><INDENT>a = []<EOL><DEDENT>weight = kwargs.get("<STR_LIT>", lambda w: <NUM_LIT:1>)<EOL>return Score(polarity = avg(map(lambda w: (w[<NUM_LIT:0>], w[<NUM_LIT:1>]), a), weight),<EOL>subjectivity = avg(map(lambda w: (w[<NUM_LIT:0>], w[<NUM_LIT:2>]), a), weight),<EOL>assessments = a)<EOL>
Returns a (polarity, subjectivity)-tuple for the given sentence,
            with polarity between -1.0 and 1.0 and subjectivity between 0.0 and 1.0.
            The sentence can be a string, Synset, Text, Sentence, Chunk, Word, Document, Vector.
            An optional weight parameter can be given,
            as a function that takes a list of words and returns a weight.