Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
TensorFSTs.jl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FAST
FST
TensorFSTs.jl
Commits
4acf81d1
Commit
4acf81d1
authored
1 year ago
by
Simon Devauchelle
Browse files
Options
Downloads
Patches
Plain Diff
Adding an initial state for tokensft
parent
1fde386c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!53
Resolve "Wrong emission IDs"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/SpeechRecognitionFSTs/SpeechRecognitionFSTs.jl
+33
-3
33 additions, 3 deletions
lib/SpeechRecognitionFSTs/SpeechRecognitionFSTs.jl
with
33 additions
and
3 deletions
lib/SpeechRecognitionFSTs/SpeechRecognitionFSTs.jl
+
33
−
3
View file @
4acf81d1
...
...
@@ -46,6 +46,8 @@ function tokenfst(
emission_count
=
1
states
=
Set
(
Int
[])
arcs
,
init
,
final
=
[],
[],
[]
if
isnothing
(
mapping
)
st
=
Set
(
Int
[])
...
...
@@ -56,11 +58,14 @@ function tokenfst(
end
mapping
=
EmissionMapping
(
length
(
st
),
length
(
tokens
))
end
# println("st "* string(length(st)))
# Extra state (infinite loop)
init_state
=
length
(
mapping
)
+
1
push!
(
states
,
init_state
)
for
(
j
,
token
)
in
enumerate
(
tokens
)
offset
=
length
(
states
)
offset
=
length
(
states
)
-
1
# values = [topo_arc[2] for topo_arc in topo]
for
(
i
,
topo_arc
)
in
enumerate
(
topo
)
src
,
dest
,
weight
=
offset
+
topo_arc
[
1
],
offset
+
topo_arc
[
2
],
topo_arc
[
3
]
...
...
@@ -72,7 +77,32 @@ function tokenfst(
dest
=
dest
,
weight
=
S
(
weight
)
)
# Init arc to sources
if
topo_arc
[
1
]
==
1
init_arc
=
Arc
(
src
=
init_state
,
isym
=
0
,
osym
=
0
,
dest
=
src
,
weight
=
S
(
weight
)
)
push!
(
arcs
,
init_arc
)
end
# Final arc to destinations
if
topo_arc
[
1
]
==
length
(
st
)
final_arc
=
Arc
(
src
=
src
,
isym
=
0
,
osym
=
0
,
dest
=
init_state
,
weight
=
S
(
weight
)
)
push!
(
arcs
,
final_arc
)
end
# print("test")
push!
(
states
,
src
)
push!
(
states
,
dest
)
push!
(
arcs
,
arc
)
...
...
@@ -89,7 +119,7 @@ function tokenfst(
push!
(
states
,
state
)
push!
(
final
,
state
=>
S
(
weight
))
end
end
end
TensorFST
(
arcs
,
init
,
final
)
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment