<filename>absa/text/opinion/meta_opinion.py<gh_stars>1-10
from typing import Union

from .polarity import Polarity, DEFAULT_POLARITY


class MetaOpinion:
    """Opinion representation

    Consist of:
    - aspect term
    - aspect category
    - polarity

    Expecting that aspect term is sequence of consecutive words.

    Attributes
    ----------
    category : str
        Aspect category of target.
    polarity : Polarity
        Polarity of target.
    """
    def __init__(self, category: str, polarity: str = None):
        self.category = category
        self.polarity = Polarity.get_polarity(polarity)

    def set_polarity(self, polarity: Union[str, int]) -> None:
        self.polarity = Polarity.get_polarity(polarity)

    def reset_polarity(self) -> None:
        self.polarity = DEFAULT_POLARITY

<filename>absa/text/opinion/meta_opinion.py<gh_stars>1-10
from typing import Union

from .polarity import Polarity, DEFAULT_POLARITY


class MetaOpinion:
    """Opinion representation

    Consist of:
    - aspect term
    - aspect category
    - polarity

    Expecting that aspect term is sequence of consecutive words.

    Attributes
    ----------
    category : str
        Aspect category of target.
    polarity : Polarity
        Polarity of target.
    """
    def __init__(self, category: str, polarity: str = None):
        self.category = category
        self.polarity = Polarity.get_polarity(polarity)

    def set_polarity(self, polarity: Union[str, int]) -> None:
        self.polarity = Polarity.get_polarity(polarity)

    def reset_polarity(self) -> None:
        self.polarity = DEFAULT_POLARITY

Opinion representation      Consist of:     - aspect term     - aspect category     - polarity      Expecting that aspect term is sequence of consecutive words.      Attributes     ----------     category : str         Aspect category of target.     polarity : Polarity         Polarity of target.