# Fftb localizaion: scores output with comma decimal separator after treebank update

**URL:** <https://delphinqa.ling.washington.edu/t/fftb-localizaion-scores-output-with-comma-decimal-separator-after-treebank-update/981>\
**Category:** fftb\
**Created:** [October 24, 2023, 2:39pm UTC](https://delphinqa.ling.washington.edu/t/fftb-localizaion-scores-output-with-comma-decimal-separator-after-treebank-update/981 "2023-10-24T14:39:56Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![olzama](https://delphinqa.ling.washington.edu/user_avatar/delphinqa.ling.washington.edu/olzama/32/6_2.png) [@olzama](https://delphinqa.ling.washington.edu/u/olzama)\
**Post date:** [October 24, 2023, 2:39pm UTC](https://delphinqa.ling.washington.edu/t/fftb-localizaion-scores-output-with-comma-decimal-separator-after-treebank-update/981/1 "2023-10-24T14:39:56Z")

</div>

On one of my computers, I was perfectly able to put the gold treebanks under tsdb/gold/ and I now see examples come up in LTDB (I cannot get the MRS displayed there but that is another matter). I do not recall any problems setting that up (although of course I may have forgotten).

Now on another machine, I am trying to set that up and, after putting the (same) treebanks under tsdb/gold/ and then running grm2db.py, I get:

```auto
rocessing /home/olga/delphin/SRG/grammar/srg/tsdb/gold/tbdb02
Traceback (most recent call last):
  File "grm2db.py", line 134, in <module>
    process_tsdb(conn, cfg['ver'], golddir, log)
  File "/home/olga/delphin/tools/ltdb/scripts/gold2db.py", line 186, in process_tsdb
    gold, sent, lexind, typind = process_results(root, log)
  File "/home/olga/delphin/tools/ltdb/scripts/gold2db.py", line 44, in process_results
    deriv = first_result.derivation()
  File "/home/olga/delphin/tools/ltdb/py3/lib/python3.7/site-packages/delphin/interface.py", line 87, in derivation
    drv = derivation.from_string(drv)
  File "/home/olga/delphin/tools/ltdb/py3/lib/python3.7/site-packages/delphin/derivation.py", line 389, in from_string
    udfnode = _from_string(s)
  File "/home/olga/delphin/tools/ltdb/py3/lib/python3.7/site-packages/delphin/derivation.py", line 474, in _from_string
    score=float(gd['score']) if gd['score'] else None,
ValueError: could not convert string to float: '0,000000'

```

What could be the reason for that? It has to be something very simple if it is working on another machine…

---

<div class="post-metadata">

**Author:** ![olzama](https://delphinqa.ling.washington.edu/user_avatar/delphinqa.ling.washington.edu/olzama/32/6_2.png) [@olzama](https://delphinqa.ling.washington.edu/u/olzama)\
**Post date:** [October 25, 2023, 8:32am UTC](https://delphinqa.ling.washington.edu/t/fftb-localizaion-scores-output-with-comma-decimal-separator-after-treebank-update/981/2 "2023-10-25T08:32:50Z")

</div>

I thought maybe it was the python version issue, somehow, because I noticed a recommendation to run the scripts with python 3.8, so I created another virtual environment using 3.8.10. That did not seem to help.

---

<div class="post-metadata">

**Author:** ![goodmami](https://delphinqa.ling.washington.edu/letter_avatar_proxy/v4/letter/g/b5e925/32.png) [@goodmami](https://delphinqa.ling.washington.edu/u/goodmami)\
**Post date:** [October 26, 2023, 12:25am UTC](https://delphinqa.ling.washington.edu/t/fftb-localizaion-scores-output-with-comma-decimal-separator-after-treebank-update/981/3 "2023-10-26T00:25:47Z")

</div>

> [@olzama](#):
>
> What could be the reason for that? It has to be something very simple if it is working on another machine…

Are these the same files? Or are you re-processing the profiles on different machines?

It looks like it could be a localization issue, with the decimal comma used instead of a decimal point (i.e., `0,000000` == `0.000000`). Python’s `float` only parses decimal points. If that’s the case, you should be able to just replace the `,` with `.` in that column.

---

<div class="post-metadata">

**Author:** ![olzama](https://delphinqa.ling.washington.edu/user_avatar/delphinqa.ling.washington.edu/olzama/32/6_2.png) [@olzama](https://delphinqa.ling.washington.edu/u/olzama)\
**Post date:** [November 9, 2023, 2:09pm UTC](https://delphinqa.ling.washington.edu/t/fftb-localizaion-scores-output-with-comma-decimal-separator-after-treebank-update/981/4 "2023-11-09T14:09:01Z")

</div>

> [@goodmami](#):
>
> Are these the same files? Or are you re-processing the profiles on different machines?

I do not think I am reprocessing anything. That’s what’s mysterious… I mean, there must be some explanation of course for why there is this comma there on one machine and not the other. But the treebanks I simply downloaded from github in both cases (at least I think so).

Replacing the commas in the derivation string doesn’t sound too robust… I’d rather obtain the correct/expected format from ACE (?) in the first place…

---

<div class="post-metadata">

**Author:** ![olzama](https://delphinqa.ling.washington.edu/user_avatar/delphinqa.ling.washington.edu/olzama/32/6_2.png) [@olzama](https://delphinqa.ling.washington.edu/u/olzama)\
**Post date:** [November 9, 2023, 2:28pm UTC](https://delphinqa.ling.washington.edu/t/fftb-localizaion-scores-output-with-comma-decimal-separator-after-treebank-update/981/5 "2023-11-09T14:28:26Z")

</div>

Here’s the workaround I did for now but I really doubt that’s the right thing to do. I still don’t understand why I have the issue in the first place (on one machine out of three; same treebanks, _I think_).

Here’s where the data comes from, a tsdb profile, processed items:

```auto
    for response in ts.processed_items():
        sid=response['i-id']
        profile = ts.path.name 
        if response['results']:
            first_result=response.result(0)
            deriv = first_result.derivation()

```

Then we get to the string representation already in pydelphin’s `interface.py`:

```auto
        drv = self.get('derivation')
        drv = re.sub(r'(\d),(\d)', r'\1.\2', drv) # Added this to get rid of the comma
        try:
            from delphin import derivation
            if isinstance(drv, dict):
                drv = derivation.from_dict(drv)
            elif isinstance(drv, str):
                drv = derivation.from_string(drv)

```

This seems to work but like I said, I doubt it’s the solution? The solution should be obtaining the `0.0000` in the first place?..

---

<div class="post-metadata">

**Author:** ![olzama](https://delphinqa.ling.washington.edu/user_avatar/delphinqa.ling.washington.edu/olzama/32/6_2.png) [@olzama](https://delphinqa.ling.washington.edu/u/olzama)\
**Post date:** [November 9, 2023, 3:03pm UTC](https://delphinqa.ling.washington.edu/t/fftb-localizaion-scores-output-with-comma-decimal-separator-after-treebank-update/981/6 "2023-11-09T15:03:07Z")

</div>

I think I am introducing these “0,0000” things by running fftb update on the profiles… Really not sure why I am only facing the issue now though. I suppose I must have done most of the treebanking on my laptop? Which is an American laptop. I didn’t think so but based on the facts… Maybe I have updated all of them again before the release, and this way the version that was released has the expected “0.0000” format in the `result`. But at the moment I update using my European office machine, I get the commas. Not sure what the best solution is?

---

<div class="post-metadata">

**Author:** ![olzama](https://delphinqa.ling.washington.edu/user_avatar/delphinqa.ling.washington.edu/olzama/32/6_2.png) [@olzama](https://delphinqa.ling.washington.edu/u/olzama)\
**Post date:** [November 9, 2023, 3:23pm UTC](https://delphinqa.ling.washington.edu/t/fftb-localizaion-scores-output-with-comma-decimal-separator-after-treebank-update/981/7 "2023-11-09T15:23:09Z")

</div>

I don’t know if this is a FFTB issue or not but at least it doesn’t appear to be an LTDB issue, so, changing the category.

---

<div class="post-metadata">

**Author:** ![olzama](https://delphinqa.ling.washington.edu/user_avatar/delphinqa.ling.washington.edu/olzama/32/6_2.png) [@olzama](https://delphinqa.ling.washington.edu/u/olzama)\
**Post date:** [November 9, 2023, 3:26pm UTC](https://delphinqa.ling.washington.edu/t/fftb-localizaion-scores-output-with-comma-decimal-separator-after-treebank-update/981/8 "2023-11-09T15:26:54Z")

</div>

@sweaglesw What do you think? Does this sound like an FFTB issue, possibly, or is this something more general, perhaps the solution is in the OS setup?

To summarize: it appears like I get tsdb profiles with the `result` file containing scores in the European format `0,0000` when I run fftb update on one of my machines, which is my office machine that was setup by someone before me.

---

<div class="post-metadata">

**Author:** ![bond](https://delphinqa.ling.washington.edu/letter_avatar_proxy/v4/letter/b/9dc877/32.png) [@bond](https://delphinqa.ling.washington.edu/u/bond)\
**Post date:** [November 9, 2023, 4:26pm UTC](https://delphinqa.ling.washington.edu/t/fftb-localizaion-scores-output-with-comma-decimal-separator-after-treebank-update/981/9 "2023-11-09T16:26:22Z")

</div>

Can you set the locale when you run it?

---

<div class="post-metadata">

**Author:** ![sweaglesw](https://delphinqa.ling.washington.edu/letter_avatar_proxy/v4/letter/s/c67d28/32.png) [@sweaglesw](https://delphinqa.ling.washington.edu/u/sweaglesw)\
**Post date:** [November 9, 2023, 4:55pm UTC](https://delphinqa.ling.washington.edu/t/fftb-localizaion-scores-output-with-comma-decimal-separator-after-treebank-update/981/10 "2023-11-09T16:55:48Z")

</div>

Hm, as Francis suggests I suspect that may be FFTB outputting the zero in European format due to locale settings, though I am not sure. I would definitely try setting the number format locale environment variable to American before running and see if that helps.

---

<div class="post-metadata">

**Author:** ![olzama](https://delphinqa.ling.washington.edu/user_avatar/delphinqa.ling.washington.edu/olzama/32/6_2.png) [@olzama](https://delphinqa.ling.washington.edu/u/olzama)\
**Post date:** [November 9, 2023, 6:09pm UTC](https://delphinqa.ling.washington.edu/t/fftb-localizaion-scores-output-with-comma-decimal-separator-after-treebank-update/981/11 "2023-11-09T18:09:14Z")

</div>

Apologies for my ignorance; how should I set the locale exactly? At what level is that done, the terminal, before I run fftb?..

---

<div class="post-metadata">

**Author:** ![bond](https://delphinqa.ling.washington.edu/letter_avatar_proxy/v4/letter/b/9dc877/32.png) [@bond](https://delphinqa.ling.washington.edu/u/bond)\
**Post date:** [November 10, 2023, 10:27am UTC](https://delphinqa.ling.washington.edu/t/fftb-localizaion-scores-output-with-comma-decimal-separator-after-treebank-update/981/12 "2023-11-10T10:27:31Z")

</div>

[https://unix.stackexchange.com/questions/7309/set-the-language-for-a-single-program-execution](https://unix.stackexchange.com/questions/7309/set-the-language-for-a-single-program-execution)

---

<div class="post-metadata">

**Author:** ![olzama](https://delphinqa.ling.washington.edu/user_avatar/delphinqa.ling.washington.edu/olzama/32/6_2.png) [@olzama](https://delphinqa.ling.washington.edu/u/olzama)\
**Post date:** [November 10, 2023, 11:42am UTC](https://delphinqa.ling.washington.edu/t/fftb-localizaion-scores-output-with-comma-decimal-separator-after-treebank-update/981/13 "2023-11-10T11:42:43Z")

</div>

Hmm.

```auto
echo $LANG
en_US.UTF-8

```

So, the locale is American already. This is in the terminal where I run fftb.

---

<div class="post-metadata">

**Author:** ![bond](https://delphinqa.ling.washington.edu/letter_avatar_proxy/v4/letter/b/9dc877/32.png) [@bond](https://delphinqa.ling.washington.edu/u/bond)\
**Post date:** [November 10, 2023, 12:04pm UTC](https://delphinqa.ling.washington.edu/t/fftb-localizaion-scores-output-with-comma-decimal-separator-after-treebank-update/981/14 "2023-11-10T12:04:56Z")

</div>

You should also check the individual settings:

$printenv | grep LC

Mine are unexpectedly varied:  
bond@tanso:~/deb$ printenv | grep LC  
LC\_ADDRESS=en\_SG.UTF-8  
LC\_NAME=en\_SG.UTF-8  
LC\_MONETARY=en\_SG.UTF-8  
LC\_PAPER=en\_SG.UTF-8  
LC\_IDENTIFICATION=en\_SG.UTF-8  
LC\_TELEPHONE=en\_SG.UTF-8  
LC\_MEASUREMENT=en\_SG.UTF-8  
LC\_TIME=en\_SG.UTF-8  
LC\_NUMERIC=en\_SG.UTF-8  
bond@tanso:~/deb$ printenv | grep LANG  
LANGUAGE=en\_AU:en\_US:en  
LANG=en\_AU.UTF-8

---

<div class="post-metadata">

**Author:** ![olzama](https://delphinqa.ling.washington.edu/user_avatar/delphinqa.ling.washington.edu/olzama/32/6_2.png) [@olzama](https://delphinqa.ling.washington.edu/u/olzama)\
**Post date:** [November 10, 2023, 12:09pm UTC](https://delphinqa.ling.washington.edu/t/fftb-localizaion-scores-output-with-comma-decimal-separator-after-treebank-update/981/15 "2023-11-10T12:09:47Z")

</div>

Aha! [command line - How to set LC\_NUMERIC to English permanently? - Ask Ubuntu](https://askubuntu.com/questions/724338/how-to-set-lc-numeric-to-english-permanently)
