movis.contrib.voicevox.merge_timeline#

movis.contrib.voicevox.merge_timeline(old_timeline: DataFrame, new_timeline: DataFrame, key='hash', description='text') DataFrame[source]#

Merge an old DataFrame with a new DataFrame to update its timeline information.

This function takes an old DataFrame and a new DataFrame, both generated by make_timeline_from_voicevox, and merges them to create an updated DataFrame. Rows in both DataFrames are compared based on the specified key column. Any discrepancies between the old and new DataFrames are flagged in the specified description column with ">>>>>" for added rows and "<<<<<" for removed rows.

Args:
old_timeline:

The old DataFrame to be updated.

new_timeline:

The new DataFrame to update the old one.

key:

The column used for comparison. Defaults to “hash”.

description:

The column where discrepancies will be flagged. Defaults to “text”.

Returns:

An updated DataFrame that merges the old and new timelines.

Example:
>>> import pandas as pd
>>> from movis.contrib.voicevox import merge_timeline
>>> old_timeline = pd.DataFrame({'hash': [1, 2], 'text': ['a', 'b']})
>>> new_timeline = pd.DataFrame({'hash': [2, 3], 'text': ['b', 'c']})
>>> merge_timeline(old_timeline, new_timeline)
hash     text
0     1  <<<<< a
1     2        b
1     3  >>>>> c