miner
Argument mining module
Module Contents
Functions
|
Select arguments mentioning the given topic. |
|
Get edges from argument dataframe. |
|
Get edge weights. |
|
Get the edge dataframe. |
|
Get labels of arguments given the attacking network. |
|
Get the node dataframe. |
- miner.select_by_topic(data: pandas.DataFrame, topic: int) pandas.DataFrame[source]
Select arguments mentioning the given topic.
- Parameters:
data (pd.DataFrame) – The argument dataframe that must contain the ‘topics’ column.
topic (int) – The given topic to select.
- Raises:
ValueError – if the ‘topics’ value of an argument is stored as something else other than a tuple (e.g. a list).
- Returns:
Part of the original argument dataframe that only contains arguments mentioning the given topic.
- Return type:
pd.DataFrame
- miner.get_edges(data: pandas.DataFrame) List[Tuple[int]][source]
Get edges from argument dataframe.
Edges (attacks) only exist if the two arguments have different overall scores. Edges are tuple of source and target, which are indices of the corresponding argument in the input dataframe.
- Parameters:
data (pd.DataFrame) – The argument dataframe that must have the ‘score’ column.
- Returns:
The edge list.
- Return type:
List[Tuple[int]]
- miner.get_edge_weights(data: pandas.DataFrame, edges: List[Tuple[int]]) List[float][source]
Get edge weights.
Edge weights are computed as the difference between the coherence of the source and that of the target.
- miner.get_edge_table(edges: List[Tuple[int]], weights: List[float]) pandas.DataFrame[source]
Get the edge dataframe.
There will be three columns in the output dataframe, which are ‘source’, ‘target’, and ‘weight’. Together, they describe weighted directed edges from source to target argument. Note that there will be no negative weights in the output dataframe, instead, all values will be replace with their absolute values. For edges with negative weights, we swap their source and target.
- Parameters:
- Raises:
ValueError – if size of the input lists doesn’t match.
- Returns:
The result edge dataframe.
- Return type:
pd.DataFrame
- miner.get_node_labels(indices: List[int], sources: List[int], targets: List[int]) List[str][source]
Get labels of arguments given the attacking network.
Arguments are separated into two classes, ‘supportive’ and ‘defeated’, which generally means reliable and unreliable. The rule of detecting the labels is as follows: if an argument is attacked by another argument who is not attacked by any argument, then this argument is labeled as ‘defeated’; otherwise, it’s labeled as ‘supportive’. That means, if an argument appears in targets, where its corresponding source doesn’t, this argument will be labeled as ‘defeated’, and otherwise ‘supportive’.