Where Linguistics meets Natural Language Processing
For someone working with Natural Language Processing/Understanding (NLP/NLU), I see a lot of value in incorporating a formal understanding of how languages are structured, beyond just being able to speak/understand them. In this talk I will give you a simple explanation of the basic concepts and their connection with the NLP/NLU world.
According to traditional linguistics, there are 5 levels of study for languages: phonetics-phonology, morphology, syntax, semantics and pragmatics. They go from the smallest unit in language, the human sounds, to the largest, language usage. We will go through all of them in the talk.
In NLP/NLU we use models for different tasks, e.g. , language understanding, topic modelling, sentiment analysis and chatbots. One of those models is the popular word2vec, which produces word embeddings. Each word’s embedding or representation is generated by using the word’s context, or set of nearby words. Pragmatics is used since the representation of the word is given by its context and semantics since each embedding represents the literal meaning of a word.
As we can see in this example, word embeddings use multiple linguistic concepts to analyze words. By combining many contextual word mappings a pragmatics based approach is used. A semantics based approach is also used because each mapping represents the literal interpretation of the word.
When we get to understand in which language layer we need to work to reach our goal, then it is easier to recognize the tool we need to use for each task. This talk introduces each of these layers, so a new data scientist can better navigate in the NLP ecosystem.
This session took place in track PyData and was classified suitable for none domain / none python by the speaker.
Transcript (auto)
Auto-generated from the recording utilizing Open-Source AI. Speaker labels (Speaker 1, Speaker 2) reflect diarization, not identity. Timestamps refer to the recording.
Speaker 1 [00:05]
I'm Mariana. How was lunch? I hope you don't come to nap here. So we're going to stretch a little bit, please, everybody. I don't see you stretching. Yeah, very good. Okay, so we can start. At the beginning of the 20th century, between 1906 and 1911, Ferdinand de Saussure, a Swiss linguist and semiotician, gave lectures about linguistics at the University of Geneva. In 1960, after Saussure's death, his students Charles Bailey and Albert, I don't know how to pronounce his name, so, said to hire a published course in general linguistics, based on their notes from Saussure's lectures. This is the moment where modern linguistics, especially structural linguistics, was born. Before Saussure, languages and their structures were studied by many people in different ways. The first register of it is from the 6th century BC in India, when Panini formulated 4000 rules of Sanskrit morphology. Plato, in his Cratilius Dialogue, mentions that words are eternal concepts and exist in a world of ideas. Which is really poetic, by the way. In 2080 BC, the University of Alexandria was founded, and Greek was taught to other speakers. From From this time, the word grammar was first used and it meant the art of writing. In the Middle Ages, languages were studied under the name of philology. Moving forward in the 18th century, Jacob Grimm wrote Deutsche Grammatik and I'm sorry for my accent with German, which is considered the first great scientific linguistic work in the world. Wilhelm von Humboldt defined human language as a rule-governed system with which we can create an infinite number of sentences using infinite grammatical rules. If we go back to the breaking point when modern linguistics was founded by Saussure, an essential concept was created the concept of signed which is the combination of signified and signifier signified is the idea or the concept and signifier is the expression making it easier signified is what is behind the world the concept and signifiers is how we express it we express it meaning with writing letters or with sounds for example because there are other ways to do it forces here signs should be studied psychocronologically because signs can be defined just when they are in construct with other signs. Starting with structuralisms, many different movements were developed. And then we found Noam Chomsky and degenerativism. Oh, I'm so sorry, I'm so nervous. Okay, in the second half of the 20th century, Noam Chomsky created this movement. It's based in syntax, but also addresses other aspects of languages, like phonology and morphology. According to Chomsky, the first thing linguistics should study is describing the universal grammar, which is a set of syntactic rules universal for all humans and the underlying grammars of all human languages. So, behind all the languages there is a grammar and this grammar is universal for all of them. Chomsky affirms that the universal grammar is innate to the human brain, that means that at some point we turn on the switch and then we get the languages. According to this movement, the primary student must be defined by the dependency tree, as the one that we can see in the slide with a famous phrase created by Chomsky, a phrase syntactically perfect but with no sense. On the opposite side of Chomsky, Michael Holliday published in 1985 an introduction to functional grammar. His theories are based on social interaction and the linguistic theory is just one part of them. So there are many and one of them is linguistics. A language is defined by Holliday as a social semiotic system, meaning that it evolves as a system of meaning potential or as a set of resources which influence what a speaker can do with language in a particular social context. In other words, languages are more than a set of sentences, but an exchange of meaning in interpersonal social context based on choices made by speakers. So, a language is used by speakers and the context and what is behind that it's what it makes it functional so if we move forward languages are studied in five levels or layers we can start describing them from the smallest unit of study to the biggest in this case phonetics and phonology is in charge of the study of sound of a human speech. Phonetics studies the human sounds, how they are produced, transmitted and received. Its unit of study is called phoneme and it's defined as perceptually a unit of sound of sound that distinguish a word in a specific language. On the other hand, phonology classifies those sounds within the system of a particular language. So phonetics splits all the sounds that humans make and phonology puts them together in a system. For example, English phonology system has 44 sounds. If we follow with the next smallest units of language, we find morphology, which is the study of words, how they are formed and related to each other. According to morphology, words are built using the smallest units of meaning, so morphemes. For example, if we have the word worker it's made by the root work and er at the end so a suffix that gives the label of noun syntax is the branch of linguistics that studies phrases meaning the set of rules of and principles that that govern the structure of phrases and sentences the study of syntax looks at the ways in which the words can be ordered and combined to transmit a proper meaning. So, syntax studies sentences, but also phrases. What does that mean? A phrase doesn't need to have a verb, but a sentence does. For example, if I say, blue garden is a phrase, and a sentence is, the blue garden is wet, for example. Semantics cares about how meaning works in a human language in a basic way, so the literal meaning of a word is considered principally as part of the human language system. On the other hand, pragmatics concentrates on how the basic meaning is used in practice and how the context affects it. explained how the talkers overcome ambiguities since the meaning relays also on the manner, the place, the previous knowledge, and the context of a communication. In the NLP and NLU world, we use different models for different tasks. For example, language understanding, topic modeling, sentiment analysis, and chatbots. One of those models is the popular Word2Vec, which produces words embeddings. Each words embeddings or representation is generated by using the words context or set of nearby words. Pragmatics is used since the representation of the word is given by its context and semantics since each embedding represents the literal meaning of a word. As we can see, word embeddings are used by multiple linguistic concepts to analyze a word. By combining many contextual word mappings, a pragmatic-based approach is used. A semantics-based approach is used because each mapping represents the literal interpretation of a word. When we talk about speech recognition engines, many APIs are available for their usage. But how do they work and how linguistic is involved in the process? When we speak, we create vibrations in the air. For speech recognition, those vibrations are sampled and digitalized by a computer by taking precise measurements of the wave at frequent intervals. The sound is filtered, so we remove unwanted noises. And normalized, so we have a constant level of sound. It's also adjusted because the speed of the speaker is different in different contexts. The resignals are divided into smaller segments as short as a few hundred of seconds or even thousand in the case of plosive constant sounds. For example, P and T are produced with the obstruction of the air flow in the vocal tract. Our filtered, normalized and divided sounds are matched to templates with the speech recognition system in the correct language. The templates are phonemines for a specific language. In the case of English, split sounds are compared and matched with 40 phonemines that are part of the English phonological system. Let's go finally to the universal language model fine-tuning for text classification from Sebastian Rudder and Jeremy Howard. This method involves fine-tuning a pre-trained model, trained on a Wikitext 103 dataset, to a new dataset in such a manner that it does not forget what is previously learned. Language modeling can be considered a counterpart of ImageNet for NLP. It captures general properties of a language and provides an enormous amount of data which can be fed to another downstream NLP task. What does capture general properties mean? So the language model learns the structure of a language, in this case, English, a structure in how the words are put together and the relationship that they have with each other. Does this sound familiar to you? I hope it does, because as we said before, linguistics study the structure of words and how they relate to each other. The fields that do that are morphology and syntax. The hierarchical structure is also captured by the language model and it's described by the syntax. When we get to understand in which level we need to work to reach our goal, then it's easier to recognize the tool we need to use for each task. So many data scientists can better navigate in the NLP ecosystem. And that's it. Thank you very much. We do have plenty of time for questions.
Speaker 2 [12:48]
Thank you for a great talk and thank you also for, I take it, your first time speaker.
Speaker 1 [12:53]
Yeah, here it is.
Speaker 2 [12:54]
Fantastic. I was wondering, you mentioned Halliday's work in linguistics and the sort of conversational aspects of language. I was wondering if you have any thoughts or like a take on how the NLP world relates to that? Because the language modeling stuff and Word2Vec and And a lot of that work is fairly static and doesn't take into account that sort of the speech acts and how context changes in a conversation and so on. So it's a fairly general question, but I was just wondering if you have any kind of take on that.
Speaker 1 [13:36]
take on that so last week I was reading this I'm sorry I don't remember the name of the lady but I was reading these slides from this teacher in the Washington University and she says the problem with NLP stock in a way is because we are considering meaning in a way that it's not the right way in linguistics so we are considering that the meaning of a word is given by its context right and that a language model can learn what a word means by their structure but she says that child's don't learn languages in that way and I think we have to find a solution to add on top of the structure and the context the meaning and that would be like moving forward I don't know if I answer your question and we have more time for questions
Speaker 3 [14:49]
Hello.
Speaker 4 [14:50]
So I started a bit.
Speaker 3 [14:51]
Hey.
Speaker 1 [14:51]
studied a bit of NLP at
Speaker 2 [14:52]
of an LP at university and wanted to know what is the gap between linguistics
Speaker 1 [14:57]
linguistics, like pure linguistics.
Speaker 2 [14:58]
like pure linguistics and NLP as a
Speaker 1 [15:00]
LPSR.
Speaker 4 [15:01]
practical matter
Speaker 1 [15:09]
to write this talk because I have to realize that many people are doing NLP without any linguistic knowledge, right? And if you don't know how a language works, you cannot improve it. If you don't know what the structure is or how the meaning works or even the context. So I think the gap is given by the practitioners so me as a linguistic I should learn more about the technical part for sure and I think the practitioners who don't have any linguistic background should learn about languages it's not hard but it takes time and we use languages every day I one of the things that I have observed is that we are all speakers right so we use language and we decide that we are all linguistics, because we speak, but it doesn't work that way. I mean, I cannot say I'm a, I don't know, I'm a dentist because I have teeth, and I think that the gap starts there. Thanks. More, please.
Speaker 4 [16:33]
Hi, thank you for your talk. I was wondering, I heard in a podcast called Data Skeptic, which is doing like a very long series on NLP, the presenter said that all these linguistic models haven't been so good at like predicting language. Like if you think of, I don't know, like Google Translate, 20 years ago, it was like not so great. And now that they like throw like neural networks and all that stuff at it, then it's getting better. So what is your take on like the theoretical side of linguistics and how can it, or like why do you think that this approaches, this new technical approaches have been so successful and how can we like go back to linguistics and learn something useful to make those models better.
Speaker 1 [17:38]
approaches are successful in a way because Google Translate it's not that good because context has been taken into consideration now I would say I would include meaning so it's not that we can take just words right like before or we can just take the other words that make a sentence because a computer cannot understand may be sarcasm right and sarcasm comes by the combination of meanings I started a theory that comes from chemistry and says that some words have like a balance so you can add many words and some words don't accept that maybe that would be a way but I really don't know
Speaker 5 [18:34]
Hello. Hi, thank you for your talk. My jaw actually dropped when you put Disassure in the first slide, and I knew it was going to be a great talk. Do you think that linguistics and this approach could be useful in studying programming languages, you know, as languages themselves?
Speaker 1 [18:53]
It does. I mean, when you study linguistics, you study. So programming languages are languages, are artificial languages, but they are languages. So you understand how grammar and syntax work. And I think for me, it was easier at least to understand the concepts.
Speaker 5 [18:54]
It does.
Speaker 1 [19:11]
So when you study linguistics, it's more abstract than practical. And when you reach that level, then you can understand programming languages in a better way. In my university back in Venezuela, I'm Venezuelan, in the master's degree, we started with people from engineering. So the idea is always to have people from both disciplines together so we can help each other. Thank you.
Speaker 5 [19:51]
Thanks for your talk. You said that language models learn words by its context, and that's not how children learn words. So, do you know how children learn words? I think it's more a visual approach, you know. You have this mapping of a concept like a tree, and then a symbol like a word, and maybe we need some more visual input for our language models.
Speaker 1 [20:16]
So the image from the tree, I can go back. So here, yeah, this is like the typical draw for a sign that we see when we learned functionalism. And the idea is to show like, so how can you describe, for example, love? It's a concept. It's an idea. It's not something that we can touch, for sure, but it's something that we all know what it is. And the tree in this case means that, that it's in our mind or whatever. And then the letters or the sounds that we used. For children, that's really, I would say, complex. So actually, Noam Chomsky said that children understand because they turn on the switch. so we have something in our inner self that let us learn a language and then uh holiday said no we learn languages because we are functional humans and or beings in general and we need to so you understand the words you learn the words but you understand the concept they use the usage and that's how it works i i think we still don't know how children learn languages it's really maybe it's all the theories together in a way i think it is i think we as humans have something that let us learn a language but also that the context and so when when you you know which voice you should use to talk in a conference or to your family or at work and that's functional I so I if you want I can send you the link of this women it's really interesting and she's suggesting many many many things are there any more questions we do have time
Speaker 3 [22:30]
Do you think that in some years' time, when NLP is learning from a lot of texts, in some years' time, there will be a lot of texts generated already by computers, that our language, the language that we use, will be affected by the fact that we will be reading stuff generated by computers? I can give you just a small background I was in a meetup organized by the publisher of BuildSite and they were really proud of generated news with data and I asked what will happen in 15 years when most of your data will be generated by computers they said we don't know
Speaker 1 [23:19]
I would say the same thing. So, we get language evolves, right? How do they evolve? They evolve because we as humans change and have some new needs. For example, how did we introduce in our languages words like washing machine or dishwasher? It was because women wanted to have something to wash the clothes, right? Instead of washing it by hand. And they decided to push and talk a lot to the kids about this. So I think, yes, it can influence a lot because actually we are using words related. So we don't look for something anymore. We Google it, right? And that's like a word that we learned from a company that it's influencing our life in a really, really, really, really big way. so I think yes because like the context in general is going to change and we are going to adapt to that new context and it's like a cycle and that context needs to adapt to us as well we have time for one last question
Speaker 6 [24:47]
Thank you for the presentation. What do you think is missing in NLP that we do have as people who speak the language or as linguists? Is it the representation that we have in the mind for a single word that we are missing in NLP? Currently, we have vector representation and in the other side we also have kind of the semantic web or with the word net this kind of stuff. So which kind of representation do you think is kind of making more sense to a linguist or even which one will be making progress in the future?
Speaker 1 [25:29]
As I said before, I think it's meaning. Meaning as a concept, as the tree, as the thing that we have in our mind. I don't think we can just add the meaning of a word with just the context and the structure. So I think we should add in a way, I don't know how, but we need to find a way to act like the meaning from the dictionary, maybe. okay let's thank you for your talk let's thank mariana again