# Path: praatio/textgrid.py
# def openTextgrid(
#     fnFullPath: str,
#     includeEmptyIntervals: bool,
#     reportingMode: Literal["silence", "warning", "error"] = "warning",
#     duplicateNamesMode: Literal["error", "rename"] = "error",
# ) -> Textgrid:
# def _dictionaryToTg(
#     tgAsDict: dict, reportingMode: Literal["silence", "warning", "error"]
# ) -> Textgrid:


import os
from os.path import join
from praatio import textgrid
"""
An example using TextgridTier set operations.

The following example is derived from real code.

The original code.  Suppose you have two tiers and want to use one tier to
filter the results of another tier.  In my case, I had textgrids with
stressed syllable and stressed vowels marked.  I wanted to extract pitch
information using this tier.  But the pitch contour contained some pitch
doubling and halving--afflicted areas were marked on a separate tier.

By taking the difference between the two tiers, we get the relevant regions,
minus areas affected by pitch halving and doubling.

I've added union and intersection here just to show their effect.
"""




def doSetOperations(fromFN, toFN):

# Path: praatio/textgrid.py
# def openTextgrid(
#     fnFullPath: str,
#     includeEmptyIntervals: bool,
#     reportingMode: Literal["silence", "warning", "error"] = "warning",
#     duplicateNamesMode: Literal["error", "rename"] = "error",
# ) -> Textgrid:
# def _dictionaryToTg(
#     tgAsDict: dict, reportingMode: Literal["silence", "warning", "error"]
# ) -> Textgrid:


# Path: examples/textgrid_set_operations.py
import os
from os.path import join
from praatio import textgrid

"""
An example using TextgridTier set operations.

The following example is derived from real code.

The original code.  Suppose you have two tiers and want to use one tier to
filter the results of another tier.  In my case, I had textgrids with
stressed syllable and stressed vowels marked.  I wanted to extract pitch
information using this tier.  But the pitch contour contained some pitch
doubling and halving--afflicted areas were marked on a separate tier.

By taking the difference between the two tiers, we get the relevant regions,
minus areas affected by pitch halving and doubling.

I've added union and intersection here just to show their effect.
"""




def doSetOperations(fromFN, toFN):

    tg = textgrid.openTextgrid(fromFN, False)