




























































































Studia grazie alle numerose risorse presenti su Docsity
Guadagna punti aiutando altri studenti oppure acquistali con un piano Premium
Questa pagina non è visibile nell’anteprima
Non perderti parti importanti!





























































































The second semester is basically about dealing with semantics. In Computational linguistics we have enemies and friends and very often they overlap. Our enemy in this case (that of Word Sense Disambiguation) is polysemy; so I decided to start this second semester talking about one big issue in CL that is Word Sense Disambiguation (WSD). We will see what exactly WSD is and, as you can see from the name, it deals with disambiguating the sense of a word in a context. This is due to the fact that words in several cases are polysemous (they have many different meanings) but, usually, in a specific context they have a specific meaning. While it’s very simple, or apparently simple, for all of us, to understand which the right sense of a word is given the context, this is not an easy issue for a machine. Maybe you remember that during the first week of CL1 I showed you a document from IBM for a conference held in Pisa in the 70s. In that document, IBM said “oh, the next step is dealing with semantics, it’s dealing with the meaning of words”. After almost 50 years we are finally there. Today we have tools that work very very well on word sense disambiguation and the LLMs revolution that happened during the last two years provided us with surprising results: if you work with ChatGPT and ask to it to disambiguate a polysemous word in context and, of course, you provide ChatGPT with a context, most likely the result will be right. As a computational linguist I’m really surprised that it works so well. Here we just bought the ChatGPT advanced version which makes use of the LLMs 4 (the free version is 3.5) and it works much better giving you the opportunity to provide ChatGPT also with a file or a number of files to process. For instance, Passarotti provided ChatGPT with a number of scientific papers and asked ChatGPT to provide a summary of all those papers: it was great. Passarotti also tested ChatGPT4 with a number of polysemous words in English and in Italian and it works really well; then he tested it also on Latin and it works so and so. If you remember the pyramid (data, information, knowledge and wisdom) the generation of Passarotti dealt with information (à computers had only data and structured data, therefore information: a treebank is information), our generation deals with knowledge (à today computers have knowledge and a LLM provides knowledge). Wisdom is not yet reached by machines, but now we have machines with knowledge and this knowledge is very very much about semantics. Passarotti started to take this course ten years ago and semantics was just at the end, in the last month. Today it’s completely the second part of the course: all we have done so far during Computational Linguistics 1, basically did not really deal with semantics, it dealt with lexicon, of course semantically reached lexical resources (à a valency lexicon is a semantically reached lexical resource, but it’s a resource, not processing), we dealt with morphology and we dealt with syntax. All towards semantics. The first problem is that the human language is ambiguous, so that many words can be interpreted in multiple ways depending on the context in which they occur. This seems to be very trivial but here there are in this first sentence some words that are key words we will deal with during these first two weeks. So “a word can be interpreted in multiple ways” means that not only a word can be polysemous, but that you can have different levels of granularity in semantics. What are the meanings of a word? Those provided by dictionary. But taking four dictionaries for the same word you will have different level of granularity for the meanings of that word. So many words can be interpreted and annotated
semantically in different ways, using different tag sets, using different levels of granularity of semantic disambiguation depending on the context in which they occur. So we are working on tokens and not on types (à because of the context. Types don’t occur in context, tokens do). This word, “context”, is a very very hot word because everything will deal with context. Everything will deal with words that surround the word you must disambiguate. The different possible uses that you can make of the context where words occur make the different models (the different methods) to perform word sense disambiguation. Context is everything. Maybe you have heard that a large language model like ChatGPT is a generative- predictive model. This means that generates words one after the other and it predicts them. What are the basis for the prediction? The context! Given a sequence of words ChatGPT, LLMs (Bert, Gemini etc.), predicts what is the most probable word that comes after; so you need a context, otherwise you cannot predict nothing. This is the reason why the accuracy rate of LLMs is important. We will talk about LLMs so often because out there, when you go in companies today, everybody wants to use LLMs. In most cases people know nothing about LLMs (it’s our job!) But everybody wants to use them because they seem to provide great results and, indeed, they provide great results. This wants to be the added value that we want to give you. We want to give the expertise, the knowledge, the competence about something that everybody out there is starting to work on. So, what is surprising of LLMs, generative- predictive LLMs, is that all that they do is to predict what is the most probable word after a given context. That’s it. It’s incredible and it works very well. So, if in this class I say “oh, I don’t remember when Robert Plant (the singer of Led Zeppelin) was born, I will search on…” you’ll complete the sentence with the word “Google” automatically. The generation of Passarotti would say “encyclopedia” (taking a lot of time!). Today “Google”! Okay, you are predictive, we are predictive. Of course, we are cognitively very very more powerful machines in terms of wisdom than computers, but we do not have the computational power to process billions of words. They have it. So, it’s the collaboration, the synergy between your cognitive power and the computational power of machines that hopefully will make the world wiser. So WSD is the ability to identify the meaning of words in context in a computational manner. Computers perform automatically the disambiguation of the senses of a word in a context and in other words it’s the ability to computationally determine which sense of a word is activated by its use in a particular context. WSD has been a fundamental task of Machine Translation (MT) already in the late 1940s. If you remember, computational linguistics basically started as a sub-field of something, as Computer science of linguistics, with a very specific aim which was the MT. Then the ALPAC report came (1966) and it says “no, you cannot deal with nothing, you’re not able to do MT”. Why? Because we were not able to perform WSD. Every time you perform MT you don’t only have to translate the syntactic structure of a sentence in a language to that sentence in another language, you must understand the meaning. This is the reason why translating poetry is so difficult, and maybe it’s not really a task. So the acknowledged hardness of WSD was one of the main obstacles to the development of MT in 1960s. Basically the ALPAC report said “go back and try to understand what is a word, what are the morphological features of a word, what is the syntax of a sentence and then come to semantics” and now we are there. When Passarotti started to study CL they were not there yet. It’s not really a different world but we are one step forward. In one sense this is a very good news; at least for us who performs everyday CL because this means that throughout these decades, we did something. We moved from just processing one single word to processing senses of words.
you deal with domain-specific text the range of variability of the meanings of a word tend to restrict (à imagine that you are dealing with the terminological domain of transportations, and you have the word “coach”. It is more probable that in the specific context it is used to indicate a part of a train). LLMs can deal with text of unrestricted nature, you can ask basically everything to ChatGPT. You can fine-tune a LLM. What does it mean? It means to specify the competence of the LLM. LLM comes with some core knowledge that is a shared knowledge and a generic knowledge. If you want to have a LLM specific for the medical area you fine-tune the LLM with data from the medical area (à like us with common knowledge of primary and secondary schools, fine-tuned then with a domain specific academic course). They are fine-tuned in order to perform domain-specific tasks. This is where we will discover that linguistic resources come to place: because if you want to build a specific LLM able to perform the syntactic analysis of Italian what do you use to fine-tune a LLM? Treebanks, UDs. The set of target words to disambiguate. This is big, macroscopic, distinction in WSD. On one side you have one target word and on the other side “all-words” settings. This means that WSD can be applied either to all the words of a text or just to some specific targeted words. WSD heavily relies on knowledge. The skeletal procedure of any WSD system can be summarized as follows: given a set of words, basically a sentence, a sequence of words, some technique is applied which makes use of one or more sources of knowledge to associate the most appropriate senses with words in context. You must know something in order to disambiguate words, the senses of words. It is much different from the chomskian approach (e.g. “syntax is one thing and semantic is another thing à “colorless green ideas sleep furiously”. This sentence is perfectly formed under a syntactic point of view but all the semantic associations among these words are wrong. If you state that syntax is strongly separated by semantics, you say that you can even not have the semantic knowledge and you don’t need it to say if a sentence is well-formed or not. This sentence is okay from a syntactic point of view but if we talk about semantics, like in this case, you need some knowledge). The point is making use of one or more sources of knowledge: whenever you perform WSD, you make use of sources, which is your experience. A machine is not a human being, so where does the knowledge to perform WSD come from? Knowledge sources can vary considerably: we can range from corpora to more structured resources such as machine-readable dictionaries and semantic networks (à like WordNet which is a very good source of knowledge. Why? Because words are associated by synonymy, antonymy, hypernymy and so on. It’s very powerful). The manual creation of knowledge resources is an expensive and time-consuming effort. Building a Wordnet is a big work and this issue of cost expensive and time- consuming effort is an issue because we realized that building resources takes time and needs money and you will never build so big resources that you can train a machine in supervised method. This the reason why today LLMs were built just on raw data (à texts not enhanced with any linguistic annotations. So you can wonder why we spent six months talking about annotation and the answer is that it’s still useful). We realized that this knowledge can be acquired both from resources (e.g. a wordnet, a dictionary) and/or from just raw text. Consider that a ten-year-old child is exposed to around, on average, one hundred million words, while ChatGPT was trained, as for English, on thirty billion words. Nobody here will never be exposed to all that training data and out of there a LLMs is able to build knowledge. So, we have some knowledge that is stored in resources and is made by us together with NLP tools and raw data. It’s the sum of the two that makes the knowledge. This is a fundamental problem which pervades overall CL and particularly the field of WSD and is called knowledge acquisition bottleneck. We must make the machine able to acquire knowledge. You must give knowledge to the machine in order to perform WSD. This knowledge is stored both on linguistic resources and in raw data. Impact. Text disambiguation can potentially provide a major breakthrough in the treatment of large- scale amounts of data, thus constituting a fundamental contribution to the realization of the so-called Semantic Web, “an extension of the current Web in which information is given well-defined meaning, better enabling computers and people to work in cooperation” [Berners-Lee et al. 2001]. In semantic web words, resources, objects : things that are published there, are related to each other by some semantic property. See the Linguistic Linked Open Data that we will see at the end of the course and
that is the skeleton of the linguistics semantic web (there is also a course about it in the second year). Together with LLMs it is one of the mainstreams of CL today. In the semantic web, what is needed to know now, words are related with some semantics predicate. For instance, imagine that Marco Passarotti is a word on the web and you are all single objects on the web: there is a relation! For instance the relation is “professor of” that goes from Passarotti to us and not viceversa and it’s semantically defined. What is important to know is that processing semantics helps to treat automatically large-scale amount of data (textual data, linguistic data affected by polysemy) with the big aim of machine translation but not only. WSD can be viewed as a classification task. PoS tagging is a classification task (à given a word you must classify it under a specific label, like “noun” for example. Basically, it’s a multi-value classification task, which means that given a word in input there are many values that you can classify the word accordingly. What are the values? The labels like noun, verb, preposition, conjunction and so on). Classification tasks are divided in two big classes: multi-value classification task and dual-classification task. The first is the task when you have to assign a class to an object according to more than two values (and the PoS are more than two), while a dual or binary classification task is the task of assigning a class to an object among two possible classes, which usually is “true”/“false” (à imagine that you have an input text and you have to assign to that text a label that tell if that text is about linguistics or not). So a classification task is a task that assigns a class to an input object. The classes can be two or more than two. Here word senses are the classes that we have to deal with. Obviously it’s much more difficult. Try to think about to all word senses that you have in mind: you cannot do it! Instead, if I ask you what the value for the morphological features of number in Italian are you immedialy say “singular and plural”: they are a finite number! So words sense are our classes and they are so many. An automatic classification method (you can use different methods) is used to assign each occurrence of a word (each token) to one or more classes. It can be possible that more classes are assigned for those contexts where an ambiguous word is used ambiguously (remember the example “la vecchia porta la sbarra”: more classes!). So, an automatic classification method is used to assign each occurrence of a word to one or more classes, that is to say to one or more senses. Based from the evidence from the context and from external knowledge sources. Okay, now we have the task in our hands: we know that the task is to classify a word according to his word sense using two things (that are two allies): the context and the knowledge. In order to allow the other person talking with you to disambiguate the meaning of word you are using you must provide him or her with some context and you must assume that he or she has some knowledge (don’t be sadistic like Passarotti with her girlfriend: don’t remove the context from a message just to see what will happen next). How does it work here? We must provide machines with the capability to perform what we perform but in a computational manner and on a very large amounts of words. The knowledge is in resources and in training data. Also, PoS and NER, name entity resolution (à the classification of target textual items into predefined categories. Like for instance proper name of countries. Name entity are basically proper names with different categories: people, countries, institutions, rock band etc.) are classification task,
class words) of a text. This task usually is not performed in a supervised manner because you have to deal with all words. This task required a large-coverage system (LLMs are a wide coverage systems, the wider ones). Consequently, purely supervised systems can potentially suffer from the problem of data sparseness, as it is unlikely that a training set of adequately sizes is available which covers full lexicon of the language of interest. While in the targeted WSD task we deal with a small and limited set of words to disambiguate and we can build an annotated corpus where all the occurrences of these words are labeled with their specific sense in that specific context, we cannot do the same when we perform an all-words WSD task, because you never know what is there. This is the reason why to perform the all-words WSD task, usually you perform an unsupervised approach (ChatGPT is a very huge unsupervised model). LLMs are not supervised, they can be supervised later in fine-tuning but in itself they are models typically built by unsupervised approach (don’t confuse them!). We will see now the four pillars of WSD. The question is about having or not an inventory of senses and to select the senses. What is a sense? Imagine, we do not agree on the set of PoS; imagine about senses (so big, so subjective)! 1) Selection of Word Senses. A word sense is a commonly accepted meaning of a word. What does it mean to be commonly accepted? It’s vague. Determining the sense inventory of a word is a key problem in WSD. A sense inventory partitions the range of meaning of a word into its senses and what senses cannot easily discretized, that is, reduced to a finite discrete set of entries each encoding one distinct meaning: language is inherently subject to change and interpretation. This is one problem. Our aim is to build a sense inventory. A sense inventory is nothing but a set of senses assigned to the words of the lexicon of a language (it’s very difficult). What is “discretized”? It means that can be strongly divided one from the other. On the other sense you’ve continuous which means that we can have overlaps. Also in PoS we have overlaps but PoS in itself are discrete: at the end you assign a PoS, only one, but originally it is not discrete. Senses, at the same time, are not clearly separated one from the other. Very often you have a grey area. And this is the reason why this is so difficult. On the other hands we continuously have new senses while a lot of existing ones die. This is different from PoS where subjects, nouns etc. never die (ex. “consistente” in Italian means “solid” but from a few years it acquired the sense of “coerente/coherent” from the English word “consistent”. The English meaning is attached to the corresponding word in Italian, even if it usually means another thing. Another example is “le classi di ginnastica”. In Italian “classi” doesn’t mean “lessons”, also this meaning comes from English). Language is something that is dynamic, that changes. So it’s very difficult to define a sense inventory because in five years it would be different. There is nothing immutable. In order to enable an objective evaluation and comparison of WSD systems, senses must be enumerated in a sense inventory (maybe this is too strong: it’s bettere to use “usually”). That is the so- called enumerative approach (it is one of the possible approaches to the problem of selection of word senses). All traditional paper-based and machine-readable dictionaries adopt the enumerative approach (because if you open a dictionary you find the senses in ordered and enumerated using some criteria). So the typical and traditional approach to the managing of senses is the enumerative approach. Another different approach is the generative approach by Pustejovsky (a Passarotti friend of
dance) in which related senses are generated from rules which capture regularities in the creation of senses. The justification is that it’s not possible to constrain the ever-changing expressivity of a word (of a language) within a predetermined set of senses. So you don’t have an inventory of senses but you have a scomposition of the meaning into components and it’s the sum of these components that give raise to the meaning. The meaning is generated according to the components (it’s like Lego). On one side you have the enumerative approach with sense inventory and on the other side you have generative approach with components that make the sense. James Pustejovsky is a pupil of Chomsky and this is why the approach take the name “generative”. He was able to build this system to scan the meaning of a sentence in its semantic component and to make it all work together using rules (it’s very nice but like many generative approaches it doesn’t work really well. It’s very difficult to make it real in a computational environment). In the generative approach senses are expressed in terms of qualia roles that is semantic features which structured the basic knowledge about an entity. The features stem from Aristotle’s basic elements for describing the meaning of lexical items. 28.02. Recap of previous lecture So, yesterday we were here. So, where we are now processed to talking about word sense disambiguation, the task to assign the correct sense of words in their context. Yesterday we mentioned the really important, relevant, core role played by context. Together with context another important role is played by knowledge. These are the two kind of information that you and the machine make you of whenever you have, or the machine has, to disambiguate the word sense in context. Yesterday we have mentioned my friend James Pustejovsky, a pupil of Chomsky, who is still alive, 96/ years old. He has just written this article on large language model, on Chat GPT on the New York Times, some weeks ago. If you search in Google “Chomsky, large language model” you will find it and I strongly disagree with that paper, because it is strongly generativist, but I’m not totally against generatism at all, I wrote a volume about “generativism” ( joking ), these mistakes that you do when you are young. Well, read it, it will be an interesting reading! Starting the real lecture In the generative approach, senses are expressed in terms of qualia roles, that is, semantic features which structure the basic knowledge about an entity. It’s like that you divide the meaning of something into two components. The features stem from Aristotle’s basic elements for describing the meaning of lexical items. Ok, now we will go on the figure of the next slide, which is about the word “knife” (coltello) and there we will see that there are 4 (+1) qualia roles are provided. The first kind of qualia role is formal (a superordinate of knife), so what kind of thing is a knife? It is an instrument. We will see that this kind of information resemble, more or less, that information that you can find in a lexical resource. What is the lexical resource where you can find the superordinate of knife, its hyperonym? It’s WordNet! Second, constitutive (parts of a knife) Third, telic (the purpose of a knife) Fourth, agentive (who uses a knife) And the instantiation of a combination of roles allows for the creation of a sense. So the full sense of the word “knife” in the generative lexicon is generated by the instantiation of the combination of these roles, by combining by joining these roles. So formally this is represented like this:
The most fortunate case is when a word is monosemous. A word is monosemous when it can convey only one meaning. There are several words in the lexicon that convey only one meaning. Many of these words are terminological words. Example about his work at Gemelli’s Hospital I was at Gemelli’s hospital, last week, reading the reports about patients and I go through a lot of monosemeous words like “biopsia” or “emocromo”. So, you see that terminological words, very often are monosemeous. We have a course here about Terminological Resources because they are an important component in NLP. I was at Gemelli because they want to perform NLP tasks on their reports of patients, and they provided us with more than 350.000 reports of the last 3 years (imagine how many million of reports they have) and reports are written using words and language. So, doctors asked us to cluster together all the report for those patients that show some common proprieties among these 350.000. You can read them one by one and say “this is here, and this is here” or you perform some NLP process that reads the text of the reports and cluster reports in different areas, in order to provide doctors with that empirical evidence, information, knowledge, that is stored in many reports that simply doctors cannot manually handle. And the experience, I’ve learnt, is so much important in medical world. Experience is there, is stored in those reports that are written and are a manifestation of language. This just to tells you how different the application of computational linguistics can be today. When I was there and I’ve studied classics, I have never thought that I would have gone to Rome, to Gemelli hospital, talking about the processing of data of the reports of doctors. That’s great! Computational Linguistics is everywhere. Back to lecture On the other side we have our enemy, polysemous words. A word is polysemous if it can convey more meanings. For instance, race (NOUN) as a competition, as a contest of speed, as a taxonomic group, etc. (Example: la gara, la razza, in English is “race”, a polysemous word). Senses of a word which can convey (usually etymologically) unrelated meanings are homonymous. For instance, race (NOUN) as a contest vs. race (NOUN) as a taxonomic group. It looks like the same word but it’s not etymologically related. But they end up being homonyms: they are written “r-a-c-e” but they come from different etymology. We have a perfect example in Italian, which is the word “accettare”, which means “to accept” and “to cut with an ax”. They end up completely homonymous, they inflect in the same way, but they are two homonymous words unrelated etymologically. It’s difficult for a machine to disambiguate which of the two “accettare” or the two “race” is the right one. But if I tell you “Ho accettato il voto all’esame” (I’ve accepted the mark at the exam) you immediately understand that is the “accettare” with the meaning “to accept” and indeed I translate “I accepted”. I did not say “I cut the exam”. So, what do you need? You need the context. Second element in WSD are external knowledge sources. First of all, we need to know an inventory of senses. So, we need to know our enemy, how big the polysemous word are in this text and how many are or can be the polysemous words. This gives you the size of the problem you have to deal with. Imagine to have a text made of one hundreds millions words and you know that just one of this polysemous and it has only two senses. So, the size of your problem is small, just performing manually. But, now you have a text of one hundred millions words and 90 thousand words are polysemous and they have a range of senses from 2 to 22. It’s much more difficult. So, first of all, know about your senses: polysemy, monosemy or homonymy. We need knowledge. You can collect knowledge from different resources. Knowledge sources (sense inventories) provide data essential to associate senses with words. We have to kinds of knowledge sources: structured and unstructured resources. Let’s have a look on structured resources:
and Wikipedia, among others. BabelNet is structured as a semantic network where nodes are multilingual synsets, i.e., groups of synonyms lexicalized in several languages, and edges are semantic relations between them. Again, the overall structure of BabelNet is very similar to the one in Word§Net: we have synsets and relations between synsets. The added value of BabelNet is that is highly multilingual and very much fine grade. There is a lot of information there, about valency, images that are able to disambiguate for visual computational automatic analysis the content of an image (we are talking about NLP but there is a lot of work in automatic processing and clustering of images. Today you can show the image of a cat to the computer and the computer will assign the annotation tag “cat”) Enjoy BabelNet, is very big and vety powerful. So, here you have knowledge, and the knowledge is stored here and it is structured. On the other side you will have sources of knowledge that are unstructured.
go in the Sala di Consultazione here, and you search for the collocations of the poem of Guido Gozzano and you search for the word “giovinezza”, you will see that all the occurrences of giovinezza preceded and followed buy the context. Five words before, five words after, that’s collocations. Already Thomas Aquinas asked to write for him collocations of Aristotels text. So, they are very important tools that are used in order to understand the language of a text. Second generation of collocations was anymore based on papers, but it was on CD-ROMs, online services, and you can decide the window size: (example) give me all the collocations of the word “table” preceded and followed by 10 words/5 words/50 words. That’s it. Collocations resources are the result of the abstraction of the data of collocations and they say “on tendency, the word “table” collocates with…”, single occurrences of “table” and its collocations on the left and on the right you can extract some information, some knowledge actually. The knowledge is that “table” tends to collocate with some words. I want that this is crystal clear because this is important to understand the next point, which is sense embeddings. Collocations are co-occurrence of a word with other words in context. I’m pretty sure that the word “professor” tends to collocate more frequently with the word “university” that with the word “racket”, or with the word “concert”. It’s clear, you know about it, knowledge, you have this knowledge, the machine doesn’t have this knowledge, but it can acquire this knowledge out of data, out of text. Why did you know that “professor” occurs more often with “university” than with “rackets”? Because you have experience and your experience is an experience of linguistic life: you know the words of your language, or maybe of other languages too. The machine does not have this knowledge but we can show to the machine a huge amount of text and out of it the machine learns that more often, more frequently “professor” co-occurs” with -2university than with “rackets”. This is the very base of embeddings. I will dedicate quite a lot of time to embeddings, because embeddings are the fundamental resources for generative pretrained transformers that you know about it GPTs and of artificial intelligence.
these levels tokenization, lemmatizazion, PoS tagging, chunking and syntactic parsing, one mode-one task. Two years ago, LLM were published, and we suddenly moved to one mode – several tasks approach. This means that we just have a LLM that can perform basically everything: you can perform tokenization, lemmatizazion, PoS tagging, chunking and syntactic parsing, named entity resolution, sentiment analysis, emotion analysis, text summarisation, machine translation… just by prompting. Prompting is telling the machine to do something. You tell the machine “Translate into English this Italian sentence”, today I was writing to a PhD student of mine, a paper, and I said “Your scientific writing is not so good. Ok let’s take your piece of paper and prompt Chat GPT to take this English text and translate it into another register, that is scientific writing. It was a wonderful scientific writing. The same model, one model, can be used for many tasks. From one model – one task to one mode- several tasks. It was a huge revolution. As a result, WSD (is performed) using discrete levels, while LLM are continuous models. They are not discrete; they do not separate lemmatisation to syntactic parsing. Is it cognitive plausible? Do we work like this? Do we separate syntax, lemmatisation and PoS while processing language? Probably not, we put it all together but please ask to a psycho linguist, not to a computational linguist. As a result of the pre-processing phase of the portion of a text, for instance, a sentence, paragraph, or a full document… every word can be represented as a vector of features, so you assign to a word a number of features. For instance, its lemma, its part of speech, its morphological features... this is vector of features. This is a result of features. Each word can be represented as a vector of features of different kinds or in more structured ways, for example, as a tree or a graph of the relations between words. For instance, in a treebank. The representation of a word in context is the main support, together with additional knowledge resources, for allowing automatic methods to choose the appropriate sense from a reference inventory. So now we have the inventory of senses, we have some knowledge based on some structured and unstructured resources and we have some features, some proprieties assigned to a word. Each word come with information about its context, knowledge about its context and features like its lemma, its PoS, its syntax. Why do we do this? We must provide these stupid machines with information so that machines can automatically perform Word disambiguation of senses. For each word we have to give to the machine information about its lemma, its PoS, its morphological features and all these stuffs… because we are still thinking about the discrete NLP approach. Every time you disambiguate a sense you do not think about a vector of features of all the words of the sentence, I hope you don’t do it! Sometimes I do it but I’m totally perverted by computational linguistics, I hope that you do not become like this. But, anyway, you do not do it, you put it all together in a continuous manner. But with a discrete approach to NLP, you have to provide machines with information about each word, context, knowledge and vector of features. So, what are these features? There are different set of features to represent the context:
trained in supervised fashion in output assigns the labels that are learnt during the learning phase. I mean if during learning phase I use tags like noun, verb, adjective, the train model will assign tags like noun, verb, adjective, without inventing any other label, but applying the labels that it learnt during the training phase. This is the point: labelled training set. Output: the assignment of the labels learnt during the training set to new instances. This approach is linked to the knowledge based approach that relies on the use of external lexical resources Unsupervised Word Sense Disambiguation Unsupervised Word Sense Disambiguation and more generally speaking unsupervised NLP are, instead, methods based on unlabelled corpora. This is the big difference. In supervised methods you have a labelled training set or corpus. In unsupervised methods you have unlabelled corpora. I think you know what we mean with unlabelled corpus : a corpus not enhanced with any label, with any linguistic annotation layer. No lemmatization, no PoS Tags, no morphological feature no syntax. Just raw text. This methods, which are based on unlabelled data, don’t exploit any manually sense tagged corpus to provide a sense choice for a word in context. So the output here is not the assignment of the labels learnt during the training phase, but is clusters of instances considered similar to each other. Let’s spend some minutes on this. So we’re talking about the different kind of outputs of supervised NLP methods and unsupervised NLP methods. I think it’s clear what the output of supervised NLP methods is: a corpus where words are assigned labels that are learnt during the training phase based on a labelled corpus. In unsupervised methods, instead you don’t deal with any label. You just have unlabelled data, you can’t exploit any manually sensed tagged corpus you can’t exploit the labels for senses assigned for corpus, because they’re not there. You cannot use these labels to provide the sense choice for the words in contexts. A sense choice are the possible choices of sense per each word that are found in a labelled corpus. If in a labelled corpus, where senses are assigned, you have the word coach , there will be some instances of the word coach where it is related to the sense train and when it is related to the sense mental coach. So in the label data you have the sense choices and the machine learns to assign the correct sense choice among the possible ones assigned by the training data to the new instances. In instead unsupervised approaches the output is not the assignment of these labels that are learnt during the training phase, because the labels are not there, but are clusters : groups, sets, of objects that share something objects that are similar in some way. Yesterday I told you about the work with the Gemelli hospital. We built clusters of patients, because starting from the reports (cartelle cliniche) some patients are more similar to each others than to others. It’s clear. So, clusters are sets of objects that share something. Clusters of instances (words) that are considered similar to eachother. The output of unsupervised Word Sense Disambiguation methods are just sets of words that are considered similar to each other. This approach is linked to the corpus based approach that doesn’t use external resources (knowledge is not provided to the machine), but it uses large quantity of data How is this similarity computed? What do we have? We have the data, corpus, and corpus is made of words and sequences of words. It’s not a bag of words in which you just put all the words of a corpus without caring about the order of the words. Instead in a corpus you have the words and the word order , which is the context. A word is preceded and followed by other words. It seems trivial but I must say it. This is all we have. Just having this information, we can build this cluster because words are considered similar to each other if they behave similarly in the training data: when they share collocations, they share the company (you should know a word by the company keeps). You build clusters of words that behave similarly in the unlabelled training data, based on the assumption that words that share similar company in the training data have something semantic similar. That’s how embeddings work, it’s how GPTs work and linguistic component of Artificial Intelligence works. Just based on huge amount of unlabelled data, machines can learn clusters of words. This is very important. Imagine a search engine like google .. I remember the 1st^ version of Google years ago. It was based on the 1.0 version of the Web. It just searched the string of characters you ware looking for: if you looked for table , tables didn’t come out. Just the string of characters, then tables started to come out thanks to lemmatization. Now if you search table, Ikea and other pieces of
furniture come out. How does it work?. Is it based on Wordnet? Maybe, but mostly they make use of embeddings , because in embeddings, in this output (which are clusters of things considered similar to each other) you will find chair, table and other pieces of furniture all together, because they behave similarly in a corpus. When I used wordvect ( It’s the original tool for building embeddings ) for the first time (don’t take notes we’ll go back to this), I was pretty surprised because suddenly I had all the prepositions for Latin all together. And then I had all the subordinate conjunctions all together and I didn’t tell the machine anything about prepositions and conjunctions. Just using the distribution of words in the unlabelled training data, the machine learnt that these words behaved similarly and that prepositions behave similarly to other prepositions. So I had all the preposition together and I said… “Oh PoS is solved!”, because if I have a machine that is able to put together all the words that share the same PoS, PoS is solved. And that’s really a revolution in the world of Computational Linguistics. We’re realizing that raw data are sufficient. Maybe. Because annotated linguistic resources still play a role. We’ll see it when we talk about fine tuning. So we firstly talked about knowledge-based approaches and Corpus- based approaches. As you know knowledge-based approaches are knowledge rich or dictionary based approaches. I already mentioned the sources of knowledge (dictionary, BabelNet, WordNet, lexicon and ontology) that are the ones relying on some external lexical resources. One or more. Such as machine-readable dictionaries, thesaurus, ontologies. Instead Corpus-based or knowledge-poor approaches don’t make use of any of the resources mentioned above for disambiguation. So knowledge based approach is usually performed in supervised Word Sense Disambiguation approaches, while the Corpus-based is u sually linked to the unsupervised approaches. So knowledge poor … usually at the exam for Computational Linguistics 1 I don’t ask about the maximum entropy approach because they find it hard, but it’s not hard. It’s the fact that there is no principle (immagino intenda dire precedente ) information. We try to build a train model with no information provided before, it’s the opposite of rule-based approach, where there is a lot of information: if there is a noun preceded by adjective, the probability that it’s a noun is so and so. Knowledge poor means that we don’t provide the machine with any previous knowledge. We let the machine learn by example like children. (When I was a child nobody told me which were nouns or adjectives. They probably told us about the subjunctive, but most of our linguistic knowledge comes just from ostension, from the daily linguistic behaviour that we have. Even if we don’t teach grammar to children, they’ll probably be able to communicate and understand. Maybe not so well, because grammar is important, but anyways that’s it). Same with machines: we don’t provide machines with knowledge, but machines are able to provide information just out of data. This is how LLMs today work. GPT is built on huge amount of unlabelled data. Today Artificial Intelligence, GPT, LLM, embeddings, are all built in unsupervised fashion using a corpus-based approach. So what is the added value of using unsupervised approaches and corpus-based approaches? The fact that you don’t need large annotated resources. You just need large data, and you know that building an annotated resource needs time and money. And the size that you reach will always be smaller than the huge amount of raw data found on the web. The problem of having limited in size annotated resourced is solved by using unsupervised approach. This was an important bottleneck in NLP. Many times in the Research Center for Latin we would have needed sense annotated corpora for Latin to perform Word Sense Disambiguation for Latin. Ok, to do so we have to start from scratch by annotating data. The same holds for other levels like sentiment analysis, you need sentiment analysis tagged corpora in order to perform sentiment analysis, but it takes time, effort. So unsupervised approaches, corpus- based approach solved the problem of having limited amount of annotated labelled data, using unlabelled training data.