fix handling of punctuation
This commit is contained in:
parent
5583865e27
commit
7a205bc6bd
2 changed files with 9 additions and 8 deletions
|
@ -1,13 +1,13 @@
|
|||
module Split (split) where
|
||||
|
||||
import Glyphs
|
||||
import Text.Megaparsec
|
||||
import Text.Megaparsec.Char
|
||||
import Data.Text (Text)
|
||||
import qualified Data.Text as Text
|
||||
import qualified Data.Char as Char
|
||||
import Data.Map (Map, (!))
|
||||
import qualified Data.Map.Strict as Map
|
||||
import Text.Megaparsec
|
||||
import Text.Megaparsec.Char
|
||||
import Data.Void
|
||||
|
||||
|
||||
|
@ -39,7 +39,8 @@ ivowel :: P Glyph
|
|||
ivowel = maxFrom "vowel" vowels
|
||||
|
||||
word :: P [Piece]
|
||||
word = (<>) <$> some initMed <*> fin where
|
||||
word = [is <> f <> concat p | is <- some initMed, f <- fin, p <- many punct]
|
||||
where
|
||||
initMed = try $
|
||||
[(i, [m]) | i <- initial, m <- medial] <|>
|
||||
[(v, []) | v <- ivowel] <|>
|
||||
|
@ -52,7 +53,7 @@ number = some (digit <|> hash) where
|
|||
digit = [(numbers ! Char.digitToInt i, []) | i <- digitChar]
|
||||
|
||||
punct :: P [Piece]
|
||||
punct = [[(p, [])] | p <- maxFrom "punctuation" punctuation]
|
||||
punct = [[(p, [])] | p <- maxFrom "punctuation" punctuation] <* space
|
||||
|
||||
dash :: P Piece
|
||||
dash = (wave, []) <$ chunk "–"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue