Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Main where
- import Text.XML.Expat.Tree
- import Text.XML.Expat.Proc
- import System.Environment (getArgs)
- import Control.Monad (liftM)
- import qualified Data.ByteString.Lazy as C
- justSentences t = filterChildrenName (=="sentence") t
- main :: IO ()
- main = do
- f <- liftM head getArgs >>= C.readFile
- let (tree, mError) = parse defaultParseOptions f
- putStrLn . show $ (length $ justSentences (tree :: UNode String))
- case mError of (Just err) -> putStrLn $ "Parsing error: " ++ (show err)
- Nothing -> return ()
Add Comment
Please, Sign In to add comment