mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-16 16:29:32 -06:00
Merge branch 'master' of https://github.com/GrammaticalFramework/gf-core
This commit is contained in:
@@ -33,9 +33,9 @@ Phrasebook</a>
|
||||
|
||||
<P><a href="http://cloud.grammaticalframework.org/minibar/minibar.html">Minibar</A>
|
||||
<!-- | <small><a href="../src/www/minibar/minibar_offline.html">Minibar offline</a></small> -->
|
||||
(<small>Predecessors:
|
||||
<!--(<small>Predecessors:
|
||||
<a href="http://www.grammaticalframework.org:41296/fridge">Fridge poetry</A>
|
||||
| <a href="http://www.grammaticalframework.org:41296/translate">Word-completing translator</A></small>)
|
||||
| <a href="http://www.grammaticalframework.org:41296/translate">Word-completing translator</A></small>)-->
|
||||
|
||||
<p><a href="http://www.grammaticalframework.org/~hallgren/Talks/GF/Tutorial2012/Ex4/answer.html">Question answering demo</a> for simple math questions.
|
||||
<P>
|
||||
@@ -63,16 +63,17 @@ to your web browser.
|
||||
<P>
|
||||
<A HREF="http://webalt.math.helsinki.fi/PublicFiles/CD/Screencast/TextMathEditor%20Demo.swf">WebALT Math Editor</A>:
|
||||
create mathematical exercises in six languages simultaneously (film).
|
||||
|
||||
<!--
|
||||
<P>
|
||||
[Out of order, early May 2012]
|
||||
<small>
|
||||
<A HREF="http://www.jem-thematic.net/en/node/846#comment-209">WebALT Math translator</A>:
|
||||
translate mathematical exercises in a web service using incremental parsing.
|
||||
</small>
|
||||
|
||||
-->
|
||||
<!--
|
||||
<P>
|
||||
<!-- <A HREF="http://csmisc14.cs.chalmers.se/~bjorn/langtrain.cgi">GF Language Trainer</A>:
|
||||
<A HREF="http://csmisc14.cs.chalmers.se/~bjorn/langtrain.cgi">GF Language Trainer</A>:
|
||||
translation quizzes in Arabic, English, Russian, Swedish. -->
|
||||
|
||||
<P>
|
||||
|
||||
@@ -445,6 +445,7 @@ pgfCommands = Map.fromList [
|
||||
],
|
||||
options = [
|
||||
("lines","return the list of lines, instead of the singleton of all contents"),
|
||||
("paragraphs","return the list of paragraphs, as separated by empty lines"),
|
||||
("tree","convert strings into trees")
|
||||
],
|
||||
exec = getEnv $ \ opts _ (Env pgf mos) -> do
|
||||
@@ -470,6 +471,7 @@ pgfCommands = Map.fromList [
|
||||
_ | isOpt "tree" opts ->
|
||||
returnFromLines [(1::Int,s)]
|
||||
_ | isOpt "lines" opts -> return (fromStrings $ lines s)
|
||||
_ | isOpt "paragraphs" opts -> return (fromStrings $ toParagraphs $ lines s)
|
||||
_ -> return (fromString s),
|
||||
flags = [("file","the input file name")]
|
||||
}),
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
-- elsewhere
|
||||
module GF.Command.CommonCommands where
|
||||
import Data.List(sort)
|
||||
import Data.Char (isSpace)
|
||||
import GF.Command.CommandInfo
|
||||
import qualified Data.Map as Map
|
||||
import GF.Infra.SIO
|
||||
@@ -116,11 +117,13 @@ commonCommands = fmap (mapCommandExec liftSIO) $ Map.fromList [
|
||||
let (os,fs) = optsAndFlags opts
|
||||
trans <- optTranslit opts
|
||||
|
||||
if isOpt "lines" opts
|
||||
then return $ fromStrings $ map (trans . stringOps (envFlag fs) (map prOpt os)) $ toStrings x
|
||||
else return ((fromString . trans . stringOps (envFlag fs) (map prOpt os) . toString) x),
|
||||
case opts of
|
||||
_ | isOpt "lines" opts -> return $ fromStrings $ map (trans . stringOps (envFlag fs) (map prOpt os)) $ toStrings x
|
||||
_ | isOpt "paragraphs" opts -> return $ fromStrings $ map (trans . stringOps (envFlag fs) (map prOpt os)) $ toParagraphs $ toStrings x
|
||||
_ -> return ((fromString . trans . stringOps (envFlag fs) (map prOpt os) . toString) x),
|
||||
options = [
|
||||
("lines","apply the operation separately to each input line, returning a list of lines")
|
||||
("lines","apply the operation separately to each input line, returning a list of lines"),
|
||||
("paragraphs","apply separately to each input paragraph (as separated by empty lines), returning a list of lines")
|
||||
] ++
|
||||
stringOpOptions,
|
||||
flags = [
|
||||
@@ -269,3 +272,11 @@ trie = render . pptss . H.toTrie . map H.toATree
|
||||
-- ** Converting command input
|
||||
toString = unwords . toStrings
|
||||
toLines = unlines . toStrings
|
||||
|
||||
toParagraphs = map (unwords . words) . toParas
|
||||
where
|
||||
toParas ls = case break (all isSpace) ls of
|
||||
([],[]) -> []
|
||||
([],_:ll) -> toParas ll
|
||||
(l, []) -> [unwords l]
|
||||
(l, _:ll) -> unwords l : toParas ll
|
||||
|
||||
@@ -22,12 +22,12 @@
|
||||
<hr>
|
||||
|
||||
<small>
|
||||
[<a href="about.html">About Minibar</a>
|
||||
[<a href="about.html">About Minibar</a><!--
|
||||
| <a href="http://www.grammaticalframework.org:41296/fridge/">Original Fridge Poetry</a>
|
||||
& <a href="http://www.grammaticalframework.org:41296/translate/">Translator</a>]
|
||||
& <a href="http://www.grammaticalframework.org:41296/translate/">Translator</a>-->]
|
||||
</small>
|
||||
<small class=modtime>
|
||||
HTML <!-- hhmts start -->Last modified: Thu Jun 9 16:13:26 CEST 2016 <!-- hhmts end -->
|
||||
HTML <!-- hhmts start -->Last modified: Wed Oct 10 14:14:10 CEST 2018 <!-- hhmts end -->
|
||||
</small>
|
||||
|
||||
<div id="debug" class="hidden"></div>
|
||||
|
||||
Reference in New Issue
Block a user