Вы находитесь на странице: 1из 36

PROGRAMMINGLANGUAGES PROGRAMMING LANGUAGES

Program setofinstructionstobeexecutedby og a set o st uct o s to be e ecuted by computer. g Algorithm,FlowCharts BinaryLanguage,Assemblylanguages,highlevel programminglanguages Compiler,Interpreter C,C++,JAVA,Perl,Python Editors,IDE,CommandModes Tools nltk toolkit,mallet,xslt,xfst tools.

Syntax,Semantics Syntax Semantics Datatypes Operators O Arithmetic Logic Relational ControlFlowStatements

LoopStatements BranchStatements Functionsandmodules Packages P k DataStructures Stack,Queue Externaldatafiles External data files Databases Oracle,SQLServer,MySQL Frameworks DotNET,J2EE OpenSourceSystems 3rd Partytools.

Encodesettingatlanguagelevel Encode setting at language level Encodesettingatdatabaselevel Unicodehandling Unicode handling UTF8 UseofGoogleandotherwebcontents U fG l d th b t t Wikiusages JournalsandConferencepaperstocheckout recentresearcharticlesinNLP

Languageanalysis Language analysis IntelligentQueryAnswering MachineTranslation Machine Translation Plagiarismtools AutomatedPoemwriting A t t dP iti Literaturecorpusanalysis Corpusbuilding SpeechtoSpeechTranslation

Blending Tamil language experts, linguistic BlendingTamillanguageexperts,linguistic experts,Computerscientists. Why Google translate, CDAC and other Major WhyGoogletranslate,CDACandotherMajor IndianUniversitiesprojectsfailedornotupto themark? Learnfrommistakes. Sharing of information between those experts Sharingofinformationbetweenthoseexperts whoworkinNLPparticularlyinTamil. Starting a Journal on Computational Tamil. StartingaJournalonComputationalTamil.

JAVA PROGRAMMING JAVAPROGRAMMING PYTHONPROGRAMMING NATURALLANGUAGEPROCESSINGUSING G G OC SS G S G PYTHON(NLTKTOOLKIT) DISCUSSIONS

publicclassprogramname{ optionalvariabledeclarationsandmethods publicstaticvoidmain(String[]args){ statements } optionalvariabledeclarationsandmethods optional variable declarations and methods }

/**Comment *Displays"HelloWorld!"tothestandardoutput. */ classHelloWorld { publicstaticvoidmain(Stringargs[]){ System.out.println( HelloWorld! );//Displaysthe System.out.println("Hello World!"); //Displays the enclosedStringontheScreenConsole }

primitivetype Wrappertype Wrapper type byte Byte short Short int Int long Long float Float double Double char Character boolean Boolean

publicclassMaxDemo { publicstaticvoidmain(Stringargs[]){ //integers bytelargestByte =Byte.MAX_VALUE; shortlargestShort =Short.MAX_VALUE; int largestInteger =Integer.MAX_VALUE; longlargestLong =Long.MAX_VALUE; //realnumbers // l b floatlargestFloat =Float.MAX_VALUE; doublelargestDouble =Double.MAX_VALUE; //otherprimitivetypes charaChar ='S'; boolean aBoolean = true; =true; //Displaythemall. System.out.println("largestbytevalueis"+largestByte +"."); System.out.println("largestshortvalueis"+largestShort +"."); System.out.println("largestintegervalueis"+largestInteger +"."); System.out.println( largestlongvalueis + largestLong + ); System out println("largest long value is "+largestLong + "."); System.out.println("largestfloatvalueis"+largestFloat +"."); System.out.println("largestdoublevalueis"+largestDouble +".");

Sample Run SampleRun Thelargestbytevalueis127. Thelargestshortvalueis32767. The largest short value is 32767. Thelargestintegervalueis2147483647. Thelargestlongvalueis 9223372036854775807. Thelargestfloatvalueis3.4028235E38. Thelargestdoublevalueis Th l d bl l i 1.7976931348623157E308.

x=1; ; y=++x; System.out.println(y); prints2,but x=1; 1 y=x++; System.out.println(y); y p (y); prints1

publicclassRelationalProg { publicstaticvoidmain(String[]args){ //afewnumbers int i =37; int j=42; int k=42; //greaterthan //greater than System.out.println("Greaterthan..."); System.out.println("i >j="+(i >j));//false System.out.println("j>i ="+(j>i));//true System.out.println("k>j="+(k>j));//false //(theyareequal) //greaterthanorequalto System.out.println("Greaterthanorequalto..."); System.out.println("i >=j="+(i >=j));//false System.out.println("j>=i ="+(j>=i));//true System.out.println("k>=j="+(k>=j));//true //lessthan //less than System.out.println("Lessthan..."); System.out.println("i <j="+(i <j));//true System.out.println("j<i ="+(j<i));//false System.out.println("k<j="+(k<j));//false

//lessthanorequalto System.out.println( Lessthanorequalto... ); System out println("Less than or equal to "); System.out.println("i <=j="+(i <=j));//true System.out.println("j<=i ="+(j<=i));//false System.out.println("k<=j="+(k<=j));//true //equalto System.out.println("Equalto..."); System.out.println("i ==j="+(i ==j));//false System.out.println("k==j="+(k==j));//true //notequalto System.out.println("Notequalto..."); System.out.println("i !=j="+(i !=j));//true System.out.println("k!=j="+(k!=j));//false System out println(" k ! j " + (k ! j)) //false } }

publicclassReadArgs { publicstaticfinalvoidmain(Stringargs[]) { for(int i=0;i<args.length;++i) { System.out.println(args[i]); } } } SampleRun Withthefollowingcommandline,theoutputshownisproduced. javaReadArgs zeroonetwothree Output: Thefollowingcommandlineargumentswerepassed: arg[0]:zero arg[1]:one arg[2]:two arg[3]:three

if(condition){ statements; statements } if(condition){ statements; }else{ statements; } if(condition){ statements; }elseif(condition){ statements; }else{ statements; }

whilethere'smoredata{ReadaLineofDataDoSomethingwiththeData} //ThisistheHelloprograminJava // This is the Hello program in Java classHello{ publicstaticvoidmain(Stringargs[]){ int i; /*Nowlet'ssayhello*/ System.out.print("Hello"); for(i=0;i <args.length;i =i++){ System.out.print(args[i]); System.out.print(""); } System.out.println(); System out println() } }

int[] k; int[]k; float[]yt; String[]names; String[] names; k=newint[3]; yt=newfloat[7]; yt = new float[7]; names=newString[50];

float[] squares = new float[101]; float[]squares=newfloat[101]; for(inti=0;i<=500;i++){ for (int i=0; i <= 500; i++) { squares[i]=i*2; } int[]k={1,2,3}; float[]yt={0.0f,1.2f,3.4f,9.87f,65.4f,0.0f, float[] yt = {0 0f 1 2f 3 4f 9 87f 65 4f 0 0f 567.9f};

classFillArray { publicstaticvoidmain(Stringargs[]){ [][] ; int[][]M; M=newint[4][5]; for(int row=0;row<4;row++){ for(int col=0;col <5;col++){ for (int col=0; col < 5; col++) { M[row][col]=row+col; } } } }

classFill3DArray{ publicstaticvoidmain(Stringargs[]){ int[][][]M; M=newint[4][5][3]; M new int[4][5][3]; for(int row=0;row<4;row++){ for(int col=0;col <5;col++){ for(int ver=0;ver <3;ver++){ for (int ver 0; ver < 3; ver++) { M[row][col][ver]=row+col+ver; } } } } }

classFactorialTest {//calculatesthefactorialofthatnumber. publicstaticvoidmain(Stringargs[]){ bl d ( []) { int n; int i; longresult; for(i 1;i < 10;i++){ for (i=1; i <=10; i++) { result=factorial(i); System.out.println(result); } }//mainendshere

staticlongfactorial(int n){ int i; longresult=1; for(i=1;i <=n;i++){ for (i=1; i <= n; i++) { result*=i; } returnresult; }//factorialendshere

publicstaticlongfactorial(int n){ if(n<0){ return1; } elseif(n==0){ return1; } else{ returnn*factorial(n1); ( ); } }

classwebsite{ class website { Stringname; S i Stringurl; Stringdescription; }

website x = new website(); websitex=newwebsite(); x.name="freehavaguide.com"; x.url= http://www.freejavaguide.com ; x url = "http://www freejavaguide com"; x.description="AJavaProgramming Website ; Website"; System.out.println(x.name+ at + x url + System out println(x name + "at"+x.url+" is"+x.description);

classsimple p {//Constructorsimple() {p=1;q=2;r=3;} int p,q,r; publicint addNumbers(int var1,int var2,int var3) {returnvar1+var2+var3;} publicvoiddisplayMessage() { { System.out.println("DisplayMessage");} S t t i tl ("Di l M ") } }

class example1{ classexample1{ publicstaticvoidmain(Stringargs[]) { //Tocreateanewinstanceclass // To create a new instance class Simplesim =newSimple(); // To show the result of the addNumbers //ToshowtheresultoftheaddNumbers System.out.println("Theresultis"+ Integer.toString(addNumbers(5,1,2))); //Todisplaymessage s sim.displayMessage();}}

interface Counting interfaceCounting { abstractvoidincrement(); abstract void increment(); abstractintgetValue(); } classScoreCounterimplementsCounting{ .... }

Python
print("Typeintegers,eachfollowedbyEnter;or^Dor^Ztofinish") total=0 total = 0 count=0 whileTrue: try: line=input() p () ifline: number=int(line) total+=number count+=1 exceptValueError aserr: print(err) continue exceptEOFError: break ifcount: print("count=",count,"total=",total,"mean=",total/count)

defget_int(msg): g ( g) whileTrue: try: i =int(input(msg)) returni exceptValueError aserr: print(err) age=get_int("enteryourage:")

iffilename.lower().endswith((".jpg",".jpeg")): print(filename,"isaJPEGimage") >>>record="LeoTolstoy*1828828*19101120" >>>fields=record.split("*") >>>fields ['LeoTolstoy','1828828','19101120'] >>>born=fields[1].split("") >>>born ['1828','8','28'] >>>died=fields[2].split("") [ ] p ( ) >>>print("livedabout",int(died[0]) int(born[0]),"years") livedabout82years

fh = None fh=None try: fh fh=open(filename,"w",encoding="utf8") (fil " " di " f8") tree.writexml(fh,encoding="UTF8") returnTrue

def connect(filename): defconnect(filename): create=notos.path.exists(filename) db db=sqlite3.connect(filename) li 3 (fil ) ifcreate: cursor=db.cursor()

cursor.execute("CREATETABLEdirectors(" "idINTEGERPRIMARYKEYAUTOINCREMENTUNIQUENOTNULL," "nameTEXTUNIQUENOTNULL)") cursor.execute("CREATETABLEdvds (" "idINTEGERPRIMARYKEYAUTOINCREMENTUNIQUENOTNULL," "titleTEXTNOTNULL," "yearINTEGERNOTNULL," "durationINTEGERNOTNULL," "director_id INTEGERNOTNULL," "FOREIGNKEY(director_id)REFERENCESdirectors)") ( ) )) db.commit() returndb