kylebgorman / pynini

Read-only mirror of Pynini
http://pynini.opengrm.org
Apache License 2.0
120 stars 26 forks source link

error when using input/output symbols #21

Closed lxkain closed 4 years ago

lxkain commented 4 years ago

When using conda-forge v2.1.0 I can do:

    fst = ni.Fst()
    state = fst.add_state()
    fst.set_start(state)
    fst.set_final(state)
    fst.add_state()
    fst.add_arc(0, ni.Arc(1, 1, 0, 1))
    fst.verify()

but what doesn't work is:

    phoneme = ['a', 'b', 'c']
    phoneme_table = ni.SymbolTable()
    phoneme_table.add_symbol('<ε>')  # empty symbol in first position
    for s in phoneme:
        phoneme_table.add_symbol(s)

    fst = ni.Fst()
    fst.set_input_symbols(phoneme_table)
    fst.set_output_symbols(phoneme_table)
    state = fst.add_state()
    fst.set_start(state)
    fst.set_final(state)
    fst.add_state()
    fst.add_arc(0, ni.Arc(1, 1, 0, 1))
    fst.verify()

then I get: ERROR: Verify: FST input label ID 1 of arc at position 0 of state 0 is missing from input symbol table ""

and

ERROR: FstPrinter: Integer 1 is not mapped to any textual symbol, symbol table = , destination =

Thing is, this used to work in v2.0.7 or thereabouts.

lxkain commented 4 years ago

This appears to be a MacOS specific bug, it works fine in Linux.

kylebgorman commented 4 years ago

Colleague tells me adding

"-stdlib=libc++"

and

   "-mmacosx-version-min=10.7"

to the extra compile arguments made things go through.

lxkain commented 4 years ago

I can confirm this.

kylebgorman commented 4 years ago

Okay, marking this closed now that this is incorporated into the setup.py.