PTQ 0.0.6 → 0.0.7
raw patch · 8 files changed
+110/−14 lines, 8 filesdep +network-uridep ~network
Dependencies added: network-uri
Dependency ranges changed: network
Files
- PTQ.cabal +13/−5
- README.md +8/−2
- cgi/main.html +1/−1
- haste/Makefile +2/−0
- haste/index.html +50/−0
- haste/ptq.hs +33/−0
- src/Main.hs +3/−2
- src/Version.hs +0/−4
PTQ.cabal view
@@ -1,10 +1,10 @@ Name: PTQ-Version: 0.0.6+Version: 0.0.7 License: LGPL License-File: COPYING Author: Masahiro Sakai Maintainer: Masahiro Sakai <masahiro.sakai AT gmail.com>-Homepage: http://www.tom.sfc.keio.ac.jp/~sakai/hiki/?hsPTQ+Homepage: http://msakai.jp/hiki/?hsPTQ Category: Natural Language Processing Build-Type: Simple Synopsis: An implementation of Montague's PTQ.@@ -14,7 +14,8 @@ Extra-Source-Files: README.md, COPYING, .travis.yml, src/Context.hs, src/MP.hs, src/PDict.hs, src/ParserTest.hs,- misc/Test.hs, misc/Test2.agda, misc/Test3.hs+ misc/Test.hs, misc/Test2.agda, misc/Test3.hs,+ haste/index.html, haste/ptq.hs, haste/Makefile Data-Files: cgi/index.html, cgi/main.html Source-Repository head@@ -31,6 +32,10 @@ Default: True Manual: True +flag network-uri+ description: Get Network.URI from the network-uri package+ default: True+ Executable ptq Main-Is: Main.hs Hs-Source-Dirs: src@@ -40,7 +45,7 @@ Translation Parser Report- Version+ Paths_PTQ Extensions: EmptyDataDecls GADTs@@ -59,7 +64,6 @@ P Translation Parser- Version ReportHTML CGI URLEncoding@@ -73,5 +77,9 @@ FlexibleInstances CPP Build-Depends: base >=4.4 && <5, mtl, containers, network, xml+ if flag(network-uri)+ build-depends: network-uri >= 2.6, network >= 2.6+ else+ build-depends: network-uri < 2.6, network < 2.6 if flag(UTF8CGI) CPP-Options: "-DUSE_UTF8"
README.md view
@@ -1,7 +1,7 @@ An implementation of Montague's PTQ in Haskell ============================================== -[](http://travis-ci.org/msakai/ptq)+[](http://travis-ci.org/msakai/ptq) [](https://hackage.haskell.org/package/PTQ) Build and Install -----------------@@ -42,4 +42,10 @@ By locating ptq.cgi, cgi/index.html and cgi/main.html to the place where CGI is executable, you can try it on the web.-Demo site runs at <http://www.tom.sfc.keio.ac.jp/~sakai/hsPTQ/>.+Demo site runs at <http://www.tom.sfc.keio.ac.jp/~sakai/hsPTQ/> (currently not working).++Haste interface+---------------++You can use [Haste](http://haste-lang.org/) to compile haste/* and run on your browsers.+Demo site runs at <https://dl.dropboxusercontent.com/u/123796/app/ptq/index.html>.
cgi/main.html view
@@ -6,7 +6,7 @@ </head> <body>-<h1>Demo page of <a href="http://www.tom.sfc.keio.ac.jp/~sakai/hiki/?hsPTQ" target="_top">PTQ</a></h1>+<h1>Demo page of <a href="http://msakai.jp/hiki/?hsPTQ" target="_top">PTQ</a></h1> <p> <form method="get" action="ptq.cgi" accept-charset="utf-8 us-ascii" target="result">
+ haste/Makefile view
@@ -0,0 +1,2 @@+ptq.js: ptq.hs+ hastec --make -O -i../src -i../dist/build/autogen -DUSE_UTF8 ptq.hs
+ haste/index.html view
@@ -0,0 +1,50 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<html>+<head>+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">+<script type="text/javascript" src="ptq.js"></script>+<title>Demo page of PTQ</title>+</head>++<body>+<h1>Demo page of <a href="http://msakai.jp/hiki/?hsPTQ" target="_top">PTQ</a></h1>++<p>+<input type="text" name="s" value="" size="100" id="input" />+<input type="submit" value="Translate!" id="button-translate-input" />+</p>++<p>+Sample: <select name="s" id="sample">+<option>John seeks a unicorn.</option>+<option>John finds a unicorn.</option>+<option>Necessarily John walks.</option>+<option>John is Bill.</option>+<option>John is a unicorn.</option>+<option>John believes that a unicorn talks.</option>+<option>Every woman loves a unicorn.</option>+<option>Every woman loves John.</option>+<option>A unicorn walks and it talks.</option>+<option>Every unicorn such that it walks talks.</option>+<option>John walks slowly.</option>+<option>John walks in a park.</option>+<option>John wishes to find a unicorn and eat it.</optoin>+<option>A man or a woman is asleep.</option>+<option>A man is asleep or a woman is asleep.</option>+<option>A man or a woman loves every unicorn.</option>+<option>A man loves every unicorn or a woman loves every unicorn.</option>+<option>Every unicorn walks or talks.</option>+<!-- ここまでは講義資料に載っていたもの -->+<option>John has sought a unicorn.</option>+<option>John will seek a unicorn.</option>+<option>A unicorn is eaten by John.</option>+<option>Every unicorn is not a man.</option>+<option>Every man loves a woman such that she loves him.</option>+</select> <input type="submit" value="Translate!" id="button-translate-sample" />+</p>++<h2>Result:</h2>+<pre id="output"></pre>++</body>+</html>
+ haste/ptq.hs view
@@ -0,0 +1,33 @@+{-# OPTIONS_GHC -Wall #-}+-----------------------------------------------------------------------------+-- |+-- Module : Main+-- Copyright : (c) Masahiro Sakai 2007-2014+-- License : BSD3-style (see LICENSE)+-- +-- Maintainer: masahiro.sakai@gmail.com+-- Stability : experimental+-- Portability : non-portable++module Main where++import Control.Monad+import Haste+import Report++main :: IO ()+main = do+ withElems ["button-translate-input", "button-translate-sample", "input", "output", "sample"] $ \[button1, button2, input, output, sample] -> do+ let update s = do+ clearChildren output+ e <- newTextElem (report s)+ addChild e output++ _ <- onEvent input OnKeyPress $ \c -> do+ when (c == fromEnum '\r' || c == fromEnum '\n') $ do+ update =<< getProp input "value"+ _ <- button1 `onEvent` OnClick $ \_ _ -> do+ update =<< getProp input "value"+ _ <- button2 `onEvent` OnClick $ \_ _ -> do+ update =<< getProp sample "value"+ return ()
src/Main.hs view
@@ -10,7 +10,8 @@ module Main where import Report-import Version+import Paths_PTQ+import Data.Version import System.IO main :: IO ()@@ -21,7 +22,7 @@ banner :: String banner = unlines- [ "PTQ version " ++ versionStr+ [ "PTQ version " ++ showVersion version , "" , "Type :quit to quit" ]
− src/Version.hs
@@ -1,4 +0,0 @@-module Version where--versionStr :: String-versionStr = "0.0.5"