Example #1
0
    // Convert to an obligatory rewrite transducer
    public static Fst ToRewriter(this Fst fst, ISet <char> alphabet)
    {
        var all         = FsaBuilder.All(alphabet);
        var notInDomain = all
                          .Difference(all.Concat(fst.Domain()).Concat(all))
                          .Identity()
                          .Optional();

        return(notInDomain.Concat(fst.Concat(notInDomain).Star()));
    }
Example #2
0
    // Convert an FST to an optional rewrite transducer
    public static Fst ToOptionalRewriter(this Fst fst, ISet <char> alphabet)
    {
        var idAll = FsaBuilder.All(alphabet).Identity();

        return(idAll.Concat(fst.Concat(idAll).Star()));
    }