formatting
This commit is contained in:
@@ -109,32 +109,35 @@ struct
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
structure EndOfPrevWord =
|
structure EndOfPrevWord =
|
||||||
MakePrevDfaLoop (
|
MakePrevDfaLoop
|
||||||
struct
|
(struct
|
||||||
val startState = startState
|
val startState = startState
|
||||||
|
|
||||||
fun fStart (idx, absIdx, str, tl, currentState, counter) =
|
fun fStart (idx, absIdx, str, tl, currentState, counter) =
|
||||||
if idx < 0 then
|
if idx < 0 then
|
||||||
case tl of
|
case tl of
|
||||||
str :: tl => fStart (String.size str - 1, absIdx, str, tl, currentState, counter)
|
str :: tl =>
|
||||||
|
fStart
|
||||||
|
(String.size str - 1, absIdx, str, tl, currentState, counter)
|
||||||
| [] => 0
|
| [] => 0
|
||||||
else
|
else
|
||||||
let
|
let
|
||||||
val chr = String.sub (str, idx)
|
val chr = String.sub (str, idx)
|
||||||
val newState = next (currentState, chr)
|
val newState = next (currentState, chr)
|
||||||
in
|
in
|
||||||
if newState = alphaToPunct orelse newState = punctToAlpha
|
if
|
||||||
|
newState = alphaToPunct orelse newState = punctToAlpha
|
||||||
orelse newState = spaceToAlpha orelse newState = spaceToPunct
|
orelse newState = spaceToAlpha orelse newState = spaceToPunct
|
||||||
then
|
then
|
||||||
if counter - 1 = 0 then
|
if counter - 1 = 0 then
|
||||||
absIdx
|
absIdx
|
||||||
else
|
else
|
||||||
fStart (idx - 1, absIdx - 1, str, tl, startState, counter - 1)
|
fStart
|
||||||
|
(idx - 1, absIdx - 1, str, tl, startState, counter - 1)
|
||||||
else
|
else
|
||||||
fStart (idx - 1, absIdx - 1, str, tl, newState, counter)
|
fStart (idx - 1, absIdx - 1, str, tl, newState, counter)
|
||||||
end
|
end
|
||||||
end
|
end)
|
||||||
)
|
|
||||||
|
|
||||||
(* w *)
|
(* w *)
|
||||||
val startOfNextWord = StartOfNextWord.next
|
val startOfNextWord = StartOfNextWord.next
|
||||||
|
|||||||
Reference in New Issue
Block a user