Success

Lecture – 40 Natural Language Processing II

Google+ Pinterest LinkedIn Tumblr

so this will be the last lecture of this course our diffusion intelligence and in this lecture we'll be dealing with the remaining issues some of the issues of natural language processing in the previous lecture on natural language processing we were trying to bring out some of the issues will dwell on the issues of machine translation a little bit today and then we'll discuss natural language understanding so today we will be discussing about the remaining part of natural language processing to start with let us have a look at the issues that are involved in machine translation because we have seen that machine translation is a very key very important aspect of many natural language applications like speech to speech text to speech even for text to speech from another language information retrieval cross language information retrieval machine translation becomes a very important issue and right now in India which is a multilingual country a lot of effort is being expended towards development of machine translators iit kanpur has developed on la vara thei a machine translation from English to Hindi and there are other efforts at different deities like IIT Kharagpur and c-dac where machine translation activities are being carried out machine translation and also a tipple IT raja baath Shakti or machine translator has been developed now when we talk about machine translation it can be takes to text machine translation that means say a text is given in Hindi and that is being translated in Bengali or it can be from speech to speech so speech to text and then machine translation of the text level and in converting that to speech which we discussed in the last lecture now most of the work that has been done has addressed pairs of widely spread languages like pairs of languages English French English Chinese English German as I said English Hindi we are working on English to Bengali that sort of activities have gone in right now works are also being carried out for Hindi to English Hindi to Bengali and Government of India has taken a lot of initiative in these activities now how to translate a text there are different approaches example based translations where we have got some templates and given a particular sentence we try to fit it to a template and that template will tell us the best way to translate it but the most commonly used approach is statistical where we learn again from the previously translated data now where from can we get a pre get translated data for that we need a parallel corpora what is a parallel corpora a parallel corpora is a collection of the pairwise sentences for example there is a English sentence and the corresponding Hindi translation of that and also that's a sentence wise but also word level every word having its translated form so it may appear to be very simple then but it's not so because of the because of the several reasons which we discussed earlier in the earlier lecture there are so many issues of resolving ambiguities and other things so for French and English and for Chinese to English there are required tools and there has been reasonable translations when a translation is being done by a machine we are not expecting perfect translation we are not also right now thinking of translating literature keeping the flavor which the human beings also cannot do most often so but if we just restrict ourselves to some routine day-to-day sentences without special flavors then we get reasonably good translations here Chinese to Hindi for example there are no such tools there are efforts going on for translating for building corpora parallel corpora for English in the Bengali Hindi etc the works are on now a major laborious task is how to obtain the parallel texts can you get it from the web in the way of most of the contents are in English so how do you get the contents from my contents say same contents in Hindi that is difficult but there are some cases where we get parallel corpora in many government records where those are also those are stored both in Hindi and English so that may be one approach now once we have the text how to get the most out of them we have to do the word alignments oh because I mean we have to really align the Hindi word with the corresponding English word we have to obtain the proper lexicon and also we'll have to import some knowledge from well studied language as we'll discuss a little later that in spite of all these techniques the domain knowledge will be required and very helpful for better performance next with this approach I mean with this overview of machine translation which is a very important activity we now move to the to another aspect of natural language processing that is natural language understanding now understanding natural language is very important because if we want to you have you have seen the dialogue in my scene right so that sort that was not a very in the very strict sense that was not a natural language understanding program but in a restricted sense yes because for the small domain it interpreted in a particular way in a very restricted format but if we want to make a dialogue system for example I type in some query and the system will understand it's not a quid not a sort of query that we give in Google I can type in any natural language query like like for example what would be the best possible train if I would like to go to Delhi maybe through Agra or maybe through lava that sort of constructs now if we types that thing in and say I let me modify the sentence a little bit what would be the best way to go to from Delhi to Bombay possibly through Allahabad or possibly through some other place at a low cost now we would like to have the system process this query understanding what exactly I want and respond back to me now natural languages can often be very difficult natural area understanding because we'll see why now our objective is to make the computers react intelligent little human speech speech is the ultimate but as an intermediate we can assume that we are typing in text this is the most natural interface to computers for example in database query right now we type in standard SQL query in the SQL language but ultimately ultimate aim could be that I am just asking for the query I am just giving a speech input speech query and I am getting the answer or I am writing the query in a free format of English and I want the answer okay now the research that is involved in that belongs to two disciplines one is AI who are focusing on developing programs that will react to language and linguistics it's a discipline studying the human language use both of them both these disciplines must collaborate hand-in-hand in order to get a good result verbal speech recognition that is related but it also requires some digital signal processing and other things where we have to extract the speech signals now all natural now one thing must be remembered that all natural languages are as complex as the other there cannot be any language which is very simple and the other is very complex ok and no natural language is best suited towards modeling or easier to process and the vocabulary of the different languages are different and that is because of the different social factors now relatively easy to derive natural language parsers are grammar for constrained English but not for general English however because in natural language we get a lot of flexibility we can use some dictionary or lexicon of words and the grammatical usage grammar can both recognize and generate sentences we can use grammar to do that another very important issue is to understand the meaning of the sentence so semantics that is much more complex as we have shown earlier that parsing a sentence helps in some way to understand which part is the subject of the sentence which part is the object and which one is the verb as we had shown in the last lecture that from the sentence I went to the bank to enjoy sunset we could buy syntactic method we could eliminate the possibility of bank from being a verb like depend that was eliminated okay but true understanding requires much more common-sense knowledge the relations the context and all these issues say if I just take this simple sentence Mary ate spaghetti with George all right now this and if I write Mary ate spaghetti with chopstick now what is the what is the difference between these two sentences the structure is saying x8y with Z that's the structure but since George is a person then Mary basically it means Mary and George ate spaghetti together whereas in the other case Mary it's spaghetti using of a chopstick so what do we really mean by understanding a sentence one way we can say that when we listen to a sentence we probably make a picture ization a perception of that maybe if we think of a large semantic net describing the world in our mind some of the nodes of those semantic Nets get activated and we get some subtree that maybe one model but still it is an open question what do you really mean by understanding a sentence an indirect way might be that if I really understand the sentence properly then I can reply to that or respond to that properly now we look at another sentence when the balloon touched the lightbulb it broke quadruped a balloon touched the light bulb and the light bulb Brooke or is it when the balloon touched the light bulb the balloon broke okay exploded because it touched the hot light bulb now how do you understand that how the Machine understand that we immediately assume that the lightbulb cannot be broken by the touch of a balloon but it is the balloon that got broken but for in order to understand this we need so much of domain-specific knowledge that are related that a balloon is a light object and a balloon cannot be a balloon is a light object and a balloon cannot break a lightbulb which is a stronger object etc so how do you go about it say when again when the balloon touch the light bulb it broke now we are going to a discourse that is a set of sentences this caused the baby to cry now what is this this the balloon caused or the event of the balloon getting broken cause the baby to cry obviously as a human being we know that this that the balloon got broken that made the baby cry right but how do you know that we know that because we have we have got a domain knowledge which has got the information that a baby likes a balloon and if any thing that is liked is broken then the person feels sad that may be stored in a semantic net or in some other form or may be in the form of rules okay now you see another point that when the balloon touched the light bulb it broke now if there was some ambiguity if my system was a little hesitant to really decide on what broke rarely the second sentence actually helps to resolve this ambiguity in this case but in some cases it can create further ambiguities as well Mary gave John a dirty look and picked up the baby probably you can picture eyes that John is the father and who probably let the balloon go and he touched the light bulb and it broke so Mary the mother was really annoyed with John and John shrugged and picked the balloon now what does it mean now with this sentence so you see there are so many scope there is scope of interpretation but we are interpreting it so naturally because of the deep knowledge of the domain of the world that we have with us now let's see how the system will react to some questions which one got broken suppose the system says balloon alright who cried the answer is baby was anyone angry now say by the reasoning that I was just orally describing you where I expected the background knowledge to be there I can get the answers and these answers are directly this keyword sir directly in this sentence but was anyone angry that is nowhere written that many was angry or John was angry but that is subject to interpretation because Mary gave John a dirty look and you see the deeper knowledge and the more complicated scenario we are going on going in that giving a dirty look implies that someone is angry now the issue is in the real world there are so many possibilities in a rule-based system if you think of can you really store all these possibilities how much will you store and can you ever make it complete so that makes the entire scenario very difficult and this is one side another side is natural language gradually evolves new words are coming in new phrases are coming in new expressions are coming in how to deal with that that is why there is an attempt to go towards statistical reasoning statistical method statistical learning and translation which is helping to have a quick-fix solution though not always very correct but mostly it works fine did John Kerr John shrugged and picked the balloon so John probably cared more for the balloon and not for the baby but that has to be inferred and this inference is quite complex the next thing is say the same thing and was the lightbulb hot the answer is yes now how did you get it yes now here it is also subject to interpretation and inference because it is coming from the domain of physics or domain of the real world that a balloon when it touches a light bulb a light bulb if on it was kept on then it is hot then only a balloon can break alright if the light bulb was off then obviously didn't break but here whether the light bulb was on or off is not the issue since it broke I we infer that must be the light bulb was hot was the balloon inflated yes and how did you get that otherwise if it is not inflated how do we say that it broke was the balloon exploded I mean that's another question was Jenkins John concerned these are all subject to interpretation and complicated inference who was responsible for the baby crying John in a way yes but actually the balloon was responsible but since Mary gave John a dirty Luke so it tells us that obviously John had something to do with the balloon going off and touching the light bulb okay so it's a much deeper inference that gives this answer John so so if we say that we were trying to parse a paragraph then all sentences we find are related to one another two different degrees and we have to denote the relationship among the components that we are getting after parsing the individual sentences see first of all we are getting the components as words and we try we try to find their part of speech all right but when these words get embedded in a sentence then also there are some ambiguities and we have to resolve them and when now now there's a paragraph so now we'll have to discuss about inter sentence relationship and maybe when we are going for a discourse consisting of a number of paragraphs we'll have to move we have to establish inter paragraph relationships so in that way it gets complicated and there as we have shown that there are some implicit knowledge about the universe and thus knowledge of presentation is very crucial about the whole thing say early toy systems such natural language systems were attempted for a long time one of the well known systems is ELISA okay it pretends to be a psychologist and talks to the user what does it do it parses a sentence and looks for key words and phrases all right user for example says I feel angry today now feel is a key word that L is a nose and feel so ELISA can therefore respond tell me why you feel angry today so it takes this entire component this entire part of the sentence feel angry today and just replace si with you so you feel angry today and this is a very routine mechanical way he is forming a question tell me why you feel angry today actually it is not deep understanding but in a way it can fool the naive users and the live users can find it very interesting that ELISA is conversing to them now in order to really build a good knowledge understand understanding system we require knowledge representation we require knowledge structures we have to have some internal representations for representing the meanings of the sentences we have to have kind of inference generation okay we have to do some syntax and semantic analysis so if we look at sentence analysis here is a serial flow of control we need many things here only a few things are enlisted all right say we have got an input sentence here that is undergoing syntactic analysis and for that we are using the grammar okay this grammar is being used and consequently we are getting the parse tree okay we are getting the parse tree as the output of the syntactic analysis all right and this is followed this parse tree as you said at the syntactic level after doing some part of speech tagging we can handle or we can deal with some of the semantic issues but there are many more semantic issues which cannot be handled at this level this is followed by semantic analysis and this is a complex problem where we'll be needing features of the domain okay we'll be needing features of the domain and after that we need some pragmatic analysis some things aren't really not possible to be uttered in a particular context those are pragmatic considerations and all through this we have to carry out inferences in order to have in order to discover the meanings as we have shown in the earlier example and sorry well that that balloon breaking issue in that case we have already seen that we often need deep semantic understanding and semantics we need a deeper inference to be carried out in order to understand because many of the things are implicit and need to be inferred and often these inferences are quite complicated all right now the point is that here we have shown a serial flow of control is the serial flow of control enough that I will first do syntactic analysis then I will do semantic analysis then pragmatic analysis then I will do inferencing possibly not not always for example if we look at these two sentences just have a look at these two sentences John Tooker flowers okay John took her flowers what does it mean so somebody brought some flowers and John took them a stranger took her money now this two takes are different this is except and this is steal okay a stranger stole her money now semantics and context are used to resolve the same syntactic ambiguities his printing mistake used to resolve this D should not be there the syntax syntactical ambiguities because here you know this is this is subject to interpretation say here when the balloon touched the lightbulb it broke this caused the baby to cry Mary gave John a dirty look and picked up the baby John Stockton picked the balloon now we can observe that seven explicit information are given like the balloon was originally inflated otherwise it would not have been balloon broke so the lightbulb was hot well these are also not very explicit they have they have got some implicit some little bit of inferences required but that is quite straightforward the balloon exploded that is straightway stated over here but they are also you see then it broke means what broke the bulb or the balloon that anaphora resolution was required to find the proper referent the explosion made a loud noise but this is inferred this is all nobody said that there was a noise but this caused the baby to cry might be the noise the baby was scared that's little relatively direct crying may have a direct relationship with being scared the loud noise scared the baby Mary picked the baby to comfort it now none of them are actually so much explicit they require some sort of influencing okay now there have been different methods which have been proposed to carry out the influencing for natural language understanding one way of doing that is the script language which is very helpful to encode stereotyping event sequences say I went to a movie last night now going to a movie is a very stereotyped scenario because all of who all of us know that there are some routine things that we must do in order to go to a movie hall and see the movie we must have money we must go to the movie hall we must get the ticket and in order to get the ticket we must have enough money so that we can pay for the ticket and after we get the ticket we proceed towards the movie hall we have to show the ticket to the usher and then we'll have to go and sit in the movie hall and watch the movie and so when I come out of the movie hall I also know that the amount of money that I had when I went in the movie hall the when I went out the amount of money left will be less because I had to pay for the ticket now this is a very stereotyped accession another very popular stereotype accession is going to a restaurant now when I go to a restaurant then I must go to the restaurant before that I must have money I must go to the restaurant I must find a seat in the restaurant I love to order food and I have to order the food so that the cost of the food is less than the money that I have after eating I have to pay for the food and when I come out then I'll have less amount of money so these are some very stereotyped pic situation as if drama script has been written and whether I go to a restaurant or you go to a restaurant or I your friend goes to a movie the steps that will be executed are very similar so such that's why this is called a script so as if we are following a script so here I went to if I say if I describe a stereotype excision using the script language then as soon as I write that I went to a movie last night you understand that I must have had money to buy a ticket that is possible to infer very easily the ticket was purchased at the theater or a movie hall I may have had to wait in the line for a bit before I can go into the theater that's a typical movie hall scenario there is a queue and you may have to wait you can further informal once inside the theater I could have bought popcorn candy or ice cream typical things that are possible he will not obviously will not assume that you have inside the movie allah will buy your chicken dish all right I exchanged the ticket with an usher who gave me a stop back etc etc etc I can go on so that is the script language now using this sort of script if we look at this balloon script here is a partial description of the balloon script so only a partial part so it's part it's possible that I blow up the balloon by mouth and tie the balloon or I could have pumped up the balloon with helium and then tied the balloon after tying the balloon a couple of things can happen either the balloon withers away okay the balloon explodes or the balloon flies away in that way we can describe the entire scenario this is a very small part of balloon and we can go on building it a complete script of the drama if we consider what happened with a child John Mary and the balloon being exploded as a drama we can write down a script in the form of some specific language as is provided by the script language but there are a couple of problems in this approach first of all the script that you write will be very complicated and often very difficult to handle another issue is that only script we find is often not enough in order to understand the scenario we have to have some basic idea of where we are trying to reach and we have to you have already learnt about planning so some sort of goal based planning is required all right but so there are different levels of planning which will be which are often found useful to characterize stereotyping situations because if I go to a movie hall I have got a complicated script over there but my objective is to see the movie and Gator said and out of the possible script actions that I'd like to take that I may possibly take I will take the best one that will satisfy my goal faster for example just you want to go to the movie hall and you have got different ways of going now in order to understand that suppose a statement is there that I went to the movie hall yesterday night I started from my home at in the evening I reached the movie hall for the night show just five minutes before the store show started and you go on saying different things now if somebody asks why were you late and will the system be able to infer that he must have gone to the movie hall not by taking a taxi or cab but rarely went by bicycle or by a slower vehicle or slower route because and why why would a person choose a slower route must be he didn't have enough money and he wanted to save money if he had taken a cab the amount of money that he would be left with would not be sufficient to buy a ticket so these are all inferences and these inferences might be you can write everything out in the script but that is that becomes very cumbersome instead if we have got a plan and you apply the planning knowledge also over here you will be in a better situation to handle it so the model of the story is in order to build an effective system script is one thing the domain knowledge is another thing maybe the semantic nets and all those things are required we need the lexicon and maybe we need the planning structure and in that way there can be numerous things which will have to be used together in order to build an effective system next we will discuss about a particular approach that's not a unique approach but that's one of the approaches that are found to be very useful in natural language understanding that is known as case frames or semantic frames now you have been you are exposed to the frame structure okay just to have a quick review a frame is a data structure like a frame boy will consist of different slots like age height weight name etc these are the slots and boy is easy and this is human etc and in age since I'm saying a boy I can also have some constraint that the age can be any value between say 5 to say 15 beyond which I will not call him a boy so when I instantiate the frame that tom is a boy then we create an instance of this frame where the we talk about a particular boy tom whose age will be set in that exact data of Tom may be five feet wait maybe 60 kilo name is Tom etc that is a frame and we have also seen that a frame can be used for and these are the constraints that we can associate with the different slots and we have also seen the frame-based influencing how it is done now in the case of a natural language understanding you see whenever I state make any sentence the boy went to school now if we take the verb and went is a past tense of go so we can create a frame go any verb and any verb will have different slots and what these slots will be one thing is is that in this case it is it can have different tenses alright but besides this so in this case went will be an instance of go with past alright but going the action of going will require or will generate can generate the question who went let me not write agent right now let me say I can ask the questions which are relevant to going what are the possible questions that I can ask I can ask who went where did he go when with whom all these are possible questions that I can ask similarly if I consider the verb give then associated with give I can have a number of queries like who gives gives what to whom we're how etcetera similarly if I take the verb eat then also I can have queries like who eats it's what we're okay say with what Tom ate spaghetti with chopstick with what etc these are some very relevant queries that are associated with a particular verb those of you who have not forgotten forgotten your school level training in Bengali or Hindi or Indian languages you must have heard of the of a thing which is called the Kurata okay in Indian language we have got six coracles alright and these are basically one called the Karaka is determined by the relationship that a word has got with the verb like Tom went to school who went to school the answer is Tom so that the answer that's a nominative case in Indian languages kata Kolok like that so who what these are different roles or in English grammar we also say these are different cases Karaka and case are the same thing okay so this sort of frames like the frame for eat which starts with who eats eats what etc these are different cases okay and that's why these are called the such frames are called case frames or they are also called semantic frames because in some way whenever we identify the Karaka we can answer we can whenever we identify the case we can answer some of the questions like say say Mary ate spaghetti with chopstick right now this sentence and if I have got a verb eat then this particular verb will be an instance of this where the tense instance of eat where the tense will be passed okay who will be Mary what will be spaghetti with what will be chopstick now when we have got this case frame instantiated then obviously if I ask the question how did Mary eat spaghetti the answer will be here and so we can say that Mary ate spaghetti with chopstick if we ask what did Mary ate the answer will come directly from this slot of this frame that's why such case frames find a lot of application in natural language understanding so as I said we were describing now frame knowledge presentation is a good way to represent some common sense and we can define some stereotypical aspects of that using frames and sentences about that domain can be parsed and the meaning can be extracted in terms of what the frames expect alright because this is important what the frames expect say I am in a scenario where say again I take the case eat alright I have got all the possible slots what who with what where etcetera now each of these slots have got an expectation that eating will so who eats this part whatever value fills it up from a sentence that has to be an animate object okay so if I say the I cannot just say the spaghetti ate male because baguette is an inanimate object what eating this must be an inanimate object so we know what is expected over here and this helps in dissolving some of the ambiguities all right where we expect a place here so that should be some sort of proper noun all right we expect some noun phrase here with what we expect some instrument or some inanimate object here or it can be also if it is an animate object in that case that will relate to who say Mary ate something suspect II with John now since John is inanimate John is animate then obviously the relationship will not will be with who that means the meaning will be this will no longer be an instrument but will be a ho age the agent of eating is Mary and John was with him so that is a co agent in that way we with looking at these possible constraints and the types of values that are filling up these blanks we can approach towards better understanding of the sentences so as we are showing that this case frames are being built around the verb phrases so we start with the actions that's activity of the sentence by the verb phrase and the thematic role all these cases that I was showing are SN also mentioned as thematic roles the different words in a sentence have got a role to play in that entire sentence any sentence it's a very interesting way of saying that say and in any sentence that I state builds of a picture right it you can think of different way I make a sentence and if there was an expert artist rarely he would have drawn that on the camp canvass immediately so that instead of listening to the sentence I can look at that picture and understand the same thing the other thing is that whenever I state a sentence see if I have got a good semantic net type of structure that sentence if I understand that sentence the proper nodes of that semantic net will be activated okay that's another way of looking at it so whenever I am just saying in a different way whenever I say a sentence that is that can always be enacted so there can be different I always talk about a theme and any theme will have different roles every component every word of the sentence plays a particular role in that drama that the sentence pitch arises okay typical thematic roles are for the time being assume that whatever slots we are showing who what these are different thematic roles and these are to be filled by a sentence and the task is to determine the thematic roles of the noun phrases now there are many theories that define different semantic thematic roles however the common objective is to understand the sentence typically the although it's not complete in Indian languages when we work then we may have a different structure a little bit extension of the thematic roles but these are more like standard agent agent is the passive or active entity that causes an action for example the sentence Donald kicked the ball okay so Donal is the agent cogent is the partner with agent for example Donal kick the ball with friend Mickey all right so here Mickey is a co agent there is a thematic object what Donal kicked what kick the ball that is the object undergoing change often another way of looking at it is that any sentence if I enact it that will create a state change Donald kick the ball so the ball moved from one place to another so the overall state changed that's also very interesting way of looking at the whole thing so the object that is undergoing change is a thematic object instrument is the tool used by the agent like Donal kick the ball with his foot location is another thematic role where action the place where action occurred Donal kick the ball on the field and in this way we can go on adding thematic roles now let us look at this diagram again here the verb is give who is giving the kind man gave a braid to the beggar for his hungry child so giving I start with giving that's a past tense who gives the kind man so the agents lot the agent role is filled with the kind man to whom who is participating in the action the beggar that fills up the co agent or the beneficiary it's not exactly a co agent it is beneficiary the beggar gave what that is the theme all right the brain fills up here the beggar comes up here or sometimes we may like to put the beggar gave the bread to the beggar that is a co agent and for his hungry child who will be ultimately benefited the hungry child will fill up here and when the time the time is not specified now if we fill up this frame so you see here that with this sentence has not filled up all the possible frames so a partial instantiation of the frame is possible and different verbs can have different frames I am just showing the verb give the domain of the role is dependent on the verb all right now a role can be a single concept or a composition based on a qualifier qualified structure like here the kind man the agent part is being filled up with this entire structure the kind man it is not only the man but it's a qualified so it's not a word but a structure right so it's us it's not a single concept but a composition now once this is filled up it is partially filled up because this sentence does not talk about the time okay so if we look at this frame then we can answer a couple of questions like who gave the bread obviously the answer will be the agent why now I am asking a difficult question why did the kind why did the kind man give the bread to the bigger the answer will be the beneficiary who is the beneficiary for his hungry child so at least to our particular level we can answer some of the queries corresponding to this so you can you are I would encourage you to take down this sentence Robbie made coffee for Susie with a percolator you can make a case frame structure for make now this is his main I'll just give you a hint now make make means making a thing okay he made a toy and make coffee that means prepare coffee so you see the verb make can have multiple frames making coffee and making a machine okay making noise okay the child made noise in that case the frame of make will change so you have to make an appropriate frame for the particular semantics of the verb and then parse this sentence and fill up the thematic roles manually and you will see that you'll be able to answer some of the questions now this is just the tip of the iceberg natural language understanding is a very interesting and very deep issue and subject and area of research so it's not possible to describe everything here but my objective was to introduce the idea to you and I'll encourage you to read about this more if you take up artificial intelligence for further studies natural language processing is a growing field and as I said before I conclude I should repeat that natural language research is a very important area specially for countries like India where we live among the multilingual community thank you

As found on YouTube