texts(list[list[str] or list[list[str]]]): the input texts to be parse. It should be a list with elements: untokenized string or tokens list.
return_visual(bool): if set True, the result will contain the dependency visualization.
texts(str or list[str]): the input texts to be parse.
Returns:
results(list[dict]): a list, with elements corresponding to each of the elements in texts. The element is a dictionary of shape:
...
...
@@ -57,23 +53,10 @@ class ddparser(hub.NLPPredictionModule):
'deprel': list[str], the dependency relation.
'prob': list[float], the prediction probility of the dependency relation.
'postag': list[str], the POS tag. If the element of the texts is list, the key 'postag' will not return.
'visual' : list[numpy.array]: the dependency visualization. Use cv2.imshow to show or cv2.imwrite to save it. If return_visual=False, it will not return.
'visual' : numpy.ndarray: the dependency visualization. Use cv2.imshow to show or cv2.imwrite to save it. If return_visual=False, it will not return.
}
"""
ifnottexts:
return
ifall([isinstance(i,str)andiforiintexts]):
do_parse=self.ddp.parse
elifall([isinstance(i,list)andiforiintexts]):
do_parse=self.ddp.parse_seg
else:
raiseValueError("All of the elements should be string or list")