Skip to content
Merged
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: 6 additions & 4 deletions egs/fisher_callhome_spanish/s5/local/merge_lexicons.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env python
# Copyright 2014 Gaurav Kumar. Apache 2.0
# 2018 Saikiran Valluri, GoVivace inc., Avaaya
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Merges unique words from Spanish Fisher, Gigaword and the LDC spanish lexicon

from __future__ import print_function
import sys
import sys, re
import json
import codecs
import operator
Expand All @@ -17,6 +17,7 @@
uw_gigaword = tmpdir + "/es_wordlist.json"
uw_LDC = ldc_lexicon + "/callhome_spanish_lexicon_970908/preferences"

filtered_letters = re.compile(u'[¡¥ª°º¿àçèëìîôö0123456789]')
merged_lexicon = []
# All three lexicons are in different formats
# First add the data from lexicon_fisher (A) into the dictionary
Expand Down Expand Up @@ -55,7 +56,8 @@
ltuples = sorted(merged_lexicon)

for item in ltuples:
lf.write(item + "\n")
if not item==u'ñ' and not re.search(filtered_letters, item):
lf.write(item + "\n")

lf.close()

Expand Down