C# Class subtitleMemorize.SubtitleMatcher

Afficher le fichier Open project: ChangSpivey/SubtitleMemorize Class Usage Examples

Méthodes publiques

Méthode Description
GetParameterCache ( List lines1, List lines2 ) : SubtitleMatcherCache
MatchSubtitles ( SubtitleMatcherCache cache ) : LinkedList

Matches the two subtitles. The problem is that no two subtiles have the same timestamps or the same number of lines (they can be split, omitted, ...). This algotithm tries to find matching lines nontheless. The general algorithm works as following: Compare every "line1" in list1 with every "line2" in list2. Generate a score (between 0 and 1) how good they overlap. If the score is above a certain threshold, there will be an edge (as in graph theory) beween line1 and line2. There result is a bipartite graph that has many connected compontens. Every connected component is then a mached line. There is another step that removes matchings where two lines in same list overlap. See documentation of "RemoveOverlappings()" for more information.

Private Methods

Méthode Description
FindBidirectionalMapping ( List mappingForLines1, List mappingForLines2 ) : LinkedList
FindMatching ( List list1, List list2 ) : void

This creates a list of good matching lines between primaryList and secondaryList.

GetLeastFittingLine ( LineInfo lineInfo, LinkedList matchingLines ) : ExtendedLineInfo

Returns the line from "matching lines" that has the least overlapping rating with "lineInfo".

RemoveOverlappings ( List primaryList ) : void

Removes the overlappings in one list. Example: sub1 is in list1 sub2 and sub3 are in list2 sub1 overlaps with sub2, sub3 + sub2 and sub3 overlap An example of this in the real worlds are announcements while the main characters are speaking. We obviously only want to map the character-dialog and the announcement to its own translation.

Method Details

GetParameterCache() public static méthode

public static GetParameterCache ( List lines1, List lines2 ) : SubtitleMatcherCache
lines1 List
lines2 List
Résultat SubtitleMatcherCache

MatchSubtitles() public static méthode

Matches the two subtitles. The problem is that no two subtiles have the same timestamps or the same number of lines (they can be split, omitted, ...). This algotithm tries to find matching lines nontheless. The general algorithm works as following: Compare every "line1" in list1 with every "line2" in list2. Generate a score (between 0 and 1) how good they overlap. If the score is above a certain threshold, there will be an edge (as in graph theory) beween line1 and line2. There result is a bipartite graph that has many connected compontens. Every connected component is then a mached line. There is another step that removes matchings where two lines in same list overlap. See documentation of "RemoveOverlappings()" for more information.
public static MatchSubtitles ( SubtitleMatcherCache cache ) : LinkedList
cache SubtitleMatcherCache
Résultat LinkedList