Contradiction analysis
- class expert.core.contradiction.contradiction_analysis.ContradictionDetector(transcription_path: str | PathLike, video_path: str | PathLike, lang: str = 'en', device: torch.device | None = None, output_dir: str | PathLike = None, chosen_intervals: List[int] = None, interval_duration: int = 60)[source]
Bases:
objectClass for working with detector of contradiction.
- Parameters
transcription_path (str | PathLike) – Path to JSON file with words from transcribation.
video_path (str | PathLike) – Path to local video file.
lang (str, optional) – Speech language for text processing [‘ru’, ‘en’]. Defaults to ‘en’.
device (str, optional) – Device type on local machine (GPU recommended). Defaults to None.
output_dir (str | PathLike) – Path to save JSON with information about contradictions.
chosen_intervals (list[int], optional) – Flags for intervals for analyzis. Defaults to []. For default settings will be analyzed full text.
interval_duration (int, optional) – The length of intervals (value in seconds). Defaults to 60.
- Returns
Path to the contradiction report.
- Return type
str
- Raises
NotImplementedError – If ‘lang’ is not equal to ‘en’ or ‘ru’.
- get_utterances(all_words: List[dict]) List[str][source]
Function for getting utterances for comparison. Split text with speech pauses :param all_words: Fragment’s words to create utterances :type all_words: List[dict]
- Returns
Utterances for comparison
- Return type
List[str]
- property device: torch.device
Check the device type.
- Returns
Device type on local machine.
- Return type
torch.device