200 likes | 402 Views
CS626/449 : Speech, NLP and the Web/Topics in AI Programming (Lecture 7: measures of word Similarity). Pushpak Bhattacharyya CSE Dept., IIT Bombay . Measures of Semantic Relatedness. Concept – Vector Based Approach
E N D
CS626/449 : Speech, NLP and the Web/Topics in AI Programming(Lecture 7: measures of word Similarity) Pushpak BhattacharyyaCSE Dept., IIT Bombay
Measures of Semantic Relatedness • Concept – Vector Based Approach • Word represented as high dimensional concept vector, v (w) = (v1,…, vn), n is no. of documents • The tf.idf score is stored in vector element • Vector v represents word w in concept space • Semantic Relatedness can be calculated using:- • This is also known as cosine similarity and the score varies from 0 to 1
Example to explain TF. IDF • Document containing 100 words wherein the word cow appears 3 times • TF for cow= 0.03 (3 / 100) • Now, assume 10 million documents and cow appears in one thousand of these • Inverse Document Frequency (IDF) of cow= ln(10 000 000 / 1 000) = 9.21 • TF-IDF score is the product of these quantities: 0.03 * 9.21 = 0.28.
Measures of Semantic Relatedness • Path – Length Based Measure • Computes Semantic Relatedness in WordNet • Views it as a graph and sees path length between concepts. “Shorter the path, the more related it is” • Good results when path consists of is-a links • Concepts are nodes and semantic relations between these concepts can be treated as edges • SR calculated by relPL (c1, c2) = Lmax– L (c1, c2) • Lmax is length of longest non-cyclic path and L (c1, c2) gives the number of edges from concept c1 to c2
Example: house • The noun house has 12 senses (first 10 from tagged texts) • 1. (1029) house -- (a dwelling that serves as living quarters for one or more families; "he has a house on Cape Cod"; "she felt she had to get out of the house") • 2. (151) house -- (an official assembly having legislative powers; "a bicameral legislature has two houses") • 3. (51) house -- (a building in which something is sheltered or located; "they had a large carriage house") • 4. (39) family, household, house, home, menage -- (a social unit living together; "he moved his family to Virginia"; "It was a good Christian household"; "I waited until the whole house was asleep"; "the teacher asked how many people made up his home") • 5. (18) theater, theatre, house -- (a building where theatrical performances or motion-picture shows can be presented; "the house was full")
Door • The noun door has 5 senses (first 3 from tagged texts) • 1. (98) door -- (a swinging or sliding barrier that will close the entrance to a room or building or vehicle; "he knocked on the door"; "he slammed the door as he left") • 2. (36) doorway, door, room access, threshold -- (the entrance (the space in a wall) through which you enter or leave a room or building; the space that a door can close; "he stuck his head in the doorway") • 3. (5) door -- (anything providing a means of access (or escape); "we closed the door to Haitian immigrants"; "education is the door to success") • 4. door -- (a structure where people live or work (usually ordered along a street or road); "the office next door"; "they live two doors up the street from us") • 5. door -- (a room that is entered via a door; "his office is the third door down the hall on the left")
House: hypernymy • => building, edifice -- (a structure that has a roof and walls and stands more or less permanently in one place; "there was a three-story building on the corner"; "it was an imposing edifice") • => structure, construction -- (a thing constructed; a complex entity constructed of many parts; "the structure consisted of a series of arches"; "she wore her hair in an amazing construction of whirls and ribbons") • => artifact, artefact -- (a man-made object taken as a whole) • => whole, unit -- (an assemblage of parts that is regarded as a single entity; "how big is that part compared to the whole?"; "the team is a unit") • => object, physical object -- (a tangible and visible entity; an entity that can cast a shadow; "it was full of rackets, balls and other objects") • => physical entity -- (an entity that has physical existence) • => entity -- (that which is perceived or known or inferred to have its own distinct existence (living or nonliving))
Door: holonymy • 2 of 5 senses of door • Sense 1 • door -- (a swinging or sliding barrier that will close the entrance to a room or building or vehicle; "he knocked on the door"; "he slammed the door as he left") • PART OF: doorway, door, room access, threshold -- (the entrance (the space in a wall) through which you enter or leave a room or building; the space that a door can close; "he stuck his head in the doorway") • Sense 2 • doorway, door, room access, threshold -- (the entrance (the space in a wall) through which you enter or leave a room or building; the space that a door can close; "he stuck his head in the doorway") • PART OF: wall -- (an architectural partition with a height and length greater than its thickness; used to divide or enclose an area or to support another structure; "the south wall had a small window"; "the walls were covered with pictures")
House: meronymy • 3 of 12 senses of house • Sense 1 • house -- (a dwelling that serves as living quarters for one or more families; "he has a house on Cape Cod"; "she felt she had to get out of the house") • HAS PART: library -- (a room where books are kept; "they had brandy in the library") • HAS PART: loft, attic, garret -- (floor consisting of open space at the top of a house just below roof; often used for storage) • HAS PART: porch -- (a structure attached to the exterior of a building often forming a covered entrance) • HAS PART: study -- (a room used for reading and writing and studying; "he knocked lightly on the closed door of the study")
Study: meronymy • Sense 5 • study -- (a room used for reading and writing and studying; "he knocked lightly on the closed door of the study") • => room -- (an area within a building enclosed by walls and floor and ceiling; "the rooms were very small but they had a nice view") • HAS PART: ceiling -- (the overhead upper surface of a room; "he hated painting the ceiling") • HAS PART: floor, flooring -- (the inside lower horizontal surface (as of a room or hallway); "they needed rugs to cover the bare floors") • HAS PART: room light -- (light that provides general illumination for a room) • HAS PART: wall -- (an architectural partition with a height and length greater than its thickness; used to divide or enclose an area or to support another structure; "the south wall had a small window"; "the walls were covered with pictures")
Wall: meronymy • 8 senses of wall • Sense 1 • wall -- (an architectural partition with a height and length greater than its thickness; used to divide or enclose an area or to support another structure; "the south wall had a small window"; "the walls were covered with pictures") • HAS PART: arch, archway -- (a passageway under a curved masonry construction; "they built a triumphal arch to memorialize their victory") • HAS PART: capstone, copestone, coping stone, stretcher -- (a stone that forms the top of wall or building) • HAS PART: course, row -- ((construction) a layer of masonry; "a course of bricks") • HAS PART: doorway, door, room access, threshold -- (the entrance (the space in a wall) through which you enter or leave a room or building; the space that a door can close; "he stuck his head in the doorway") • HAS PART: casing, case -- (the enclosing frame around a door or window opening; "the casings had rotted away and had to be replaced") • HAS PART: door -- (a swinging or sliding barrier that will close the entrance to a room or building or vehicle; "he knocked on the door"; "he slammed the door as he left")
Door: meronymy • 2 of 5 senses of door • Sense 1 • door -- (a swinging or sliding barrier that will close the entrance to a room or building or vehicle; "he knocked on the door"; "he slammed the door as he left") • HAS PART: lock -- (a fastener fitted to a door or drawer to keep it firmly closed) • Sense 2 • doorway, door, room access, threshold -- (the entrance (the space in a wall) through which you enter or leave a room or building; the space that a door can close; "he stuck his head in the doorway") • HAS PART: casing, case -- (the enclosing frame around a door or window opening; "the casings had rotted away and had to be replaced") • HAS PART: door -- (a swinging or sliding barrier that will close the entrance to a room or building or vehicle; "he knocked on the door"; "he slammed the door as he left")
Final picture • Door belongs-to 12 senses Sense-1 House study wall Has-part Has-part Has-part door doorway lock Has-part Has-part
Another picture: through hypernymy (is-a) • Sense 1 • lock -- (a fastener fitted to a door or drawer to keep it firmly closed) • => fastener, fastening, holdfast, fixing -- (restraint that attaches to something or holds something in place) • => restraint, constraint -- (a device that retards something's motion; "the car did not have proper restraints fitted") • => device -- (an instrumentality invented for a particular purpose; "the device is small enough to wear on your wrist"; "a device intended to conserve water") • => instrumentality, instrumentation -- (an artifact (or system of artifacts) that is instrumental in accomplishing some end) • => artifact, artefact -- (a man-made object taken as a whole) • => whole, unit -- (an assemblage of parts that is regarded as a single entity; "how big is that part compared to the whole?"; "the team is a unit") • => object, physical object -- (a tangible and visible entity; an entity that can cast a shadow; "it was full of rackets, balls and other objects") • => physical entity -- (an entity that has physical existence) • => entity -- (that which is perceived or known or inferred to have its own distinct existence (living or nonliving))
Sense 1 • house -- (a dwelling that serves as living quarters for one or more families; "he has a house on Cape Cod"; "she felt she had to get out of the house") • => dwelling, home, domicile, abode, habitation, dwelling house -- (housing that someone is living in; "he built a modest dwelling near the pond"; "they raise money to provide homes for the homeless") • => housing, lodging, living accommodations -- (structures collectively in which people are housed) • => structure, construction -- (a thing constructed; a complex entity constructed of many parts; "the structure consisted of a series of arches"; "she wore her hair in an amazing construction of whirls and ribbons") • => artifact, artefact -- (a man-made object taken as a whole) • => whole, unit -- (an assemblage of parts that is regarded as a single entity; "how big is that part compared to the whole?"; "the team is a unit") • => object, physical object -- (a tangible and visible entity; an entity that can cast a shadow; "it was full of rackets, balls and other objects") • => physical entity -- (an entity that has physical existence) • => entity -- (that which is perceived or known or inferred to have its own distinct existence (living or nonliving))
=> building, edifice -- (a structure that has a roof and walls and stands more or less permanently in one place; "there was a three-story building on the corner"; "it was an imposing edifice") • => structure, construction -- (a thing constructed; a complex entity constructed of many parts; "the structure consisted of a series of arches"; "she wore her hair in an amazing construction of whirls and ribbons") • => artifact, artefact -- (a man-made object taken as a whole) • => whole, unit -- (an assemblage of parts that is regarded as a single entity; "how big is that part compared to the whole?"; "the team is a unit") • => object, physical object -- (a tangible and visible entity; an entity that can cast a shadow; "it was full of rackets, balls and other objects") • => physical entity -- (an entity that has physical existence) • => entity -- (that which is perceived or known or inferred to have its own distinct existence (living or nonliving))
Sense 2 • house -- (an official assembly having legislative powers; "a bicameral legislature has two houses") • => legislature, legislative assembly, legislative, general assembly, law-makers -- (persons who make or amend or repeal laws) • => assembly -- (a group of persons gathered together for a common purpose) • => gathering, assemblage -- (a group of persons together in one place) • => social group -- (people sharing some social relation) • => group, grouping -- (any number of entities (members) considered as a unit) • => abstraction -- (a general concept formed by extracting common features from specific examples) • => abstract entity -- (an entity that exists only abstractly) • => entity -- (that which is perceived or known or inferred to have its own distinct existence (living or nonliving))
Sense 3 • house -- (a building in which something is sheltered or located; "they had a large carriage house") • => building, edifice -- (a structure that has a roof and walls and stands more or less permanently in one place; "there was a three-story building on the corner"; "it was an imposing edifice") • => structure, construction -- (a thing constructed; a complex entity constructed of many parts; "the structure consisted of a series of arches"; "she wore her hair in an amazing construction of whirls and ribbons") • => artifact, artefact -- (a man-made object taken as a whole) • => whole, unit -- (an assemblage of parts that is regarded as a single entity; "how big is that part compared to the whole?"; "the team is a unit") • => object, physical object -- (a tangible and visible entity; an entity that can cast a shadow; "it was full of rackets, balls and other objects") • => physical entity -- (an entity that has physical existence) • => entity -- (that which is perceived or known or inferred to have its own distinct existence (living or nonliving))
Sense 4 • family, household, house, home, menage -- (a social unit living together; "he moved his family to Virginia"; "It was a good Christian household"; "I waited until the whole house was asleep"; "the teacher asked how many people made up his home") • => unit, social unit -- (an organization regarded as part of a larger social group; "the coach said the offensive unit did a good job"; "after the battle the soldier had trouble rejoining his unit") • => organization, organisation -- (a group of people who work together) • => social group -- (people sharing some social relation) • => group, grouping -- (any number of entities (members) considered as a unit) • => abstraction -- (a general concept formed by extracting common features from specific examples) • => abstract entity -- (an entity that exists only abstractly) • => entity -- (that which is perceived or known or inferred to have its own distinct existence (living or nonliving))
Sense 11 • sign of the zodiac, star sign, sign, mansion, house, planetary house -- ((astrology) one of 12 equal areas into which the zodiac is divided) • => region, part -- (the extended spatial location of something; "the farming regions of France"; "religions in all parts of the world"; "regions of outer space") • => location -- (a point or extent in space) • => object, physical object -- (a tangible and visible entity; an entity that can cast a shadow; "it was full of rackets, balls and other objects") • => physical entity -- (an entity that has physical existence) • => entity -- (that which is perceived or known or inferred to have its own distinct existence (living or nonliving))