litsa hackathon - qna quick start guide
DESCRIPTION
LITSA Hackathon - QnA Quick Start GuideTRANSCRIPT
-
QnAMarkupQuickStarthttp://www.qnamarkup.org
QnAisamarkuplanguageforpeoplewithlittleornoprogrammingexperience.Itwasdesignedwithattorneysinmindandtransformsblocksoftextintointeractivequestionandanswersessions(QnAs).TheseQnAscanbeusedasstandaloneexpertsystemsorintheaidofrulebaseddocumentconstruction.Plus,theentireprojectisopensource.Amongotherthings,thatmeansfree.AFewExamples
QnAusesspeciallyformattedtext(e.g.,aQ:atthebeginningofaline)todefinehowacomputerwillpresenttext.Thesebitsofformatingarecalledtags,andQnAonlyhasten.Letsusetwoofthem(Q&A)torewritethedecisiontreeontheleft.Ofcourse,toseeinteractiveoutput,youllneedtotypeourtextintoaQnAeditor/interpreterliketheoneavailableattheURLabove. ThecontentsofQ(question)tagsarerenderedinsideleftalignedtextbubbles.ThefirstQtag'scontentisvisibleafterloading.ThecontentofotherQtagsbecomevisibleafterauserselectsitsprecedingAtag.Soourdecisiontreebecomessomethinglikethis.
Q:Isthewindblowingnorthbynorthwest?A:Yes.
Q:No.Yetthereismethodinit.A:No.
Q:Yes.
IfyouputtheaboveintoaQnAeditorandhitUpdateOutputs,youllseeaninteractiveversionofthetree.YoullalsoseeasetoftargetidsaddedtoyourQtags.Forexample:
Q(1):Isthewindblowingnorthbynorthwest?A:Yes.
Q(1.1):No.Yetthereismethodinit.A:No.
Q(1.2):Yes.
Thesewillbecomeusefulinamoment.
-
Anyhow,itseasytoseehowyoucouldcontinuethisformatingforadditionalbranches,andalthoughthisexampledoesntshowit,youcanincludeasmanyAtagsasyoulike.Justrememberindentsareimportant.
Q:Willyouspendmoretimeintransitthanatyourdestination?A:Yes.
Q:Isyourtripmotivatedbylove?A:Yes.
Q:Yes!A:No.
Q:ProbablynotA:No.
Q:Maybe
Butwhatifwehaveadecisiontreewithbranchesthatdomorethanfork?Whatiftheyjoinbackonthemselves?Noproblem.Takeforexample:
Q(1):IsthedigraphafterC?A:Yes.
Q(1.1):EbeforeIA:No.
Q(1.2):IsthedigraphanAsoundasinneighbororweigh?
A:Yes.Q(1.2.1):GOTO:1.1
A:No.Q(1.2.2):ProbablyIbeforeE,
buttherecouldbeanexception.EnglishisWEIRD!
Seewhatwedidwiththosetargetids?WeusedaGOTOtagtoredirecttheuser.Thisallowsustojoinbranches.NowwhataboutthatweirdQRCode?CanweaddlinkstoourQnA?Yes.YoucanaddlinkstoanAtagbyplacingtheURLinbrackets,likethis:
[...]Q(1.2.2):ProbablyIbeforeE,buttherecouldbeanexception.EnglishisWEIRD!A:[http://steve.wagar.com/ibeforee.htm]Seeforyourself.
-
Ifyouwantuserstotypeananswer,youllneedanewtag.TheXtagworksprettymuchliketheAtag,exceptthatitrenderstheanswerasatextfieldinsteadofabutton.ThetextfollowinganXtagbecomesthenameofavariablecontainingtheusersanswer.Youllseewhatthatmeansinaminute.Letsseewhatwecandowiththisdecisiontree?Forstarters,wellturnGenerate(new)Xintoaquestion,Whatisyourworkingtitle?Forthefulleffect,youllwanttodropthistextinaQnAeditor.Canyoufigureouthowitwillrender?
Q(1):Whatisyourworkingtitle?X:mytitle
Q(1.1):Hum...Isthereapuninthere?A:Yes.
Q(1.1.1):GOTO:2A:No.
Q(1.1.2):Anywordplay?A:Yes.
Q(1.1.2.1):GOTO:2A:No.
Q(1.1.2.2):Latin?A:Yes.
Q(1.1.2.2.1):GOTO:2A:No.
Q(1.1.2.2.2):Wellthatwon'tdo.Thinkhard.GOTO:1Q(2):Sinequanon.FeelenTITLEDtouse"mytitle."
Thatsright,usersareaskedtotypeintheirworkingtitle,andifitpassesallthetests,itisshowntotheuserattheend.Butthatsnotall,youcandomorethanjustsendpeopletowebsitesandparrotbackthingstheytyped.Youcanstitcheverythingtogethertocreateadocumentbasedonausersanswerstoquestions.YoucanfindeverythingyoutobuildyourowndocumentsontheSyntax&Usagepageat:http://www.qnamarkup.org/syntax/Youllalsofindanexplinationofalltentags.Afterthatremember,practicemakesyoubetter.