Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No public description #350

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion nisaba/scripts/natural_translit/utils/type_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def value_from_list(some_list, index, exclude=UNSPECIFIED, instead=0):

import logging
import numbers
from typing import Dict, Iterable, List, NamedTuple, Tuple, Union
from typing import Dict, Iterable, List, NamedTuple, Tuple, Union, Callable
import pynini as pyn

# Custom types
Expand Down Expand Up @@ -631,3 +631,11 @@ def in_attribute(
look_for, get_attribute(thing, attr),
keys, enf_list, enf_dict, enf_range, allow_none
)


# TODO: Switch to list_op and remove duplicate when is fixed.
def apply_foreach(
func: Callable[[Valid,], Valid], arg_list: List[Valid]
) -> list[...]:
"""Temporary duplicate of apply_foreach in list_op with Valid type."""
return [func(*args) for args in arg_list]