Finite-state transducer that classifies URLs, emails, and similar electronic tokens during English text normalization. Reuse when extracting or verbalizing electronic entities in NLP pipelines.
# Source: https://github.com/modelscope/FunASR | License: MIT | Copyright 2025 FunASR
# Provided via justclaw.it.com; keep this notice with the code.
import pynini
from fun_text_processing.text_normalization.en.graph_utils import (
DAMO_ALPHA,
DAMO_DIGIT,
DAMO_SIGMA,
GraphFst,
get_abs_path,
insert_space,
)
from pynini.lib import pynutil
class ElectronicFst(GraphFst):
"""
Finite state transducer for classifying electronic: as URLs, email addresses, etc.
e.g. cdf1@abc.edu -> tokens { electronic { username: "cdf1" domain: "abc.edu" } }
Args:
deterministic: if True will provide a single transduction option,
for False multiple transduction are generated (used for audio-based normalization)
"""
def __init__(self, determi
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key