def load(self, path=None):
<EOL>if not path:<EOL><INDENT>path = self._path<EOL><DEDENT>if not os.path.exists(path):<EOL><INDENT>return<EOL><DEDENT>words, synsets, labels = {}, {}, {}<EOL>xml = cElementTree.parse(path)<EOL>xml = xml.getroot()<EOL>for w in xml.findall("<STR_LIT>"):<EOL><INDENT>if self._confidence is Noneor self._confidence <= float(w.attrib.get("<STR_LIT>", <NUM_LIT:0.0>)):<EOL><INDENT>w, pos, p, s, i, label, synset = (<EOL>w.attrib.get("<STR_LIT>"),<EOL>w.attrib.get("<STR_LIT>"),<EOL>w.attrib.get("<STR_LIT>", <NUM_LIT:0.0>),<EOL>w.attrib.get("<STR_LIT>", <NUM_LIT:0.0>),<EOL>w.attrib.get("<STR_LIT>", <NUM_LIT:1.0>),<EOL>w.attrib.get("<STR_LIT:label>"),<EOL>w.attrib.get(self._synset) <EOL>)<EOL>psi = (float(p), float(s), float(i))<EOL>if w:<EOL><INDENT>words.setdefault(w, {}).setdefault(pos, []).append(psi)<EOL><DEDENT>if w and label:<EOL><INDENT>labels[w] = label<EOL><DEDENT>if synset:<EOL><INDENT>synsets.setdefault(synset, []).append(psi)<EOL><DEDENT><DEDENT><DEDENT>self._language = xml.attrib.get("<STR_LIT>", self._language)<EOL>for w in words:<EOL><INDENT>words[w] = dict((pos, [avg(each) for each in zip(*psi)]) for pos, psi in words[w].items())<EOL><DEDENT>for w, pos in list(words.items()):<EOL><INDENT>words[w][None] = [avg(each) for each in zip(*pos.values())]<EOL><DEDENT>for id, psi in synsets.items():<EOL><INDENT>synsets[id] = [avg(each) for each in zip(*psi)]<EOL><DEDENT>dict.update(self, words)<EOL>dict.update(self.labeler, labels)<EOL>dict.update(self._synsets, synsets)<EOL>
Loads the XML-file (with sentiment annotations) from the given path.
            By default, Sentiment.path is lazily loaded.