**[ [[cqp:introduction|Collection: Introduction to CQP]] ]**
====== 3d. Metadata ======
//This section introduces two important ways of working with metadata. It presupposes that you have read [[cqp:corpus-structure|Section 1]] and [[cqp:simple-queries|Section 2]].//
As explained in [[cqp:corpus-structure| Section 1]], corpora often contain metadata in the form of xml tags like the following (simplified) example:
…
'' enclosing paragraphs or '''' or ''
'' tags are now displayed in a concordance line. To turn the display off again, use the same command with a minus sign, i.e., type show -p ===== Displaying linguistic annotation ===== As also discussed in [[cqp:concordances|Section 3f]], the ''show'' command can also be used to display information from the columns following the ''word'' column. For example, if your corpus contains ''pos'' tags (as the BNC does), you can type the following before creating your concordance: show +pos Try it, you will see that for each word in the concordance line, its ''pos'' tag is now shown, separated from the word by a slash, Again, to turn the display off again, use the same command with a minus sign, i.e., type show -pos ===== Restricting a search by metadata ===== A more sophisticated way that you can use metadata is by restricting your search to examples that match a particular value of a metadata attribute. This is done by attaching the command '':: match.//attribute//="//value//"'' to the end of your query. For example, you may be interested in whether men and women use the word ''love'' differently. The BNC contains the attribute ''text_author_sex'' with the values ''male'', ''female'' and ''unknown''. To find only uses of the word //love// produced by men, type the following and hit ''RETURN'': [hw="love"] :: match.text_author_sex="male" To find only uses of the word //love// produced by women, type the following and hit ''RETURN'': [hw="love"] :: match.text_author_sex="female" ===== Summary and outlook ===== This section has shown you how work with metadata. Building on this, you can look at the following sections in any order: * [[cqp:extending-queries-combinations|Section 3a]]: Extending simple queries: Alternative attributes and values * [[cqp:extending-queries-alternatives|Section 3b]]: Extending simple queries: Combinations of attributes and values * [[cqp:complex-queries|Section 3c]]: Complex Queries * [[cqp:regular-expressions-basics|Section 3e]]: Regular expressions (basics) * [[cqp:concordances|Section 3f]]: Working with concordances * [[cqp:sorting-sampling|Section 3g]]: Sorting and sampling **[ Introduction to CQP: [[cqp:corpus-structure|Section 1]] -- [[cqp:simple-queries|Section 2]] -- [[cqp:advanced-querying|Section 3]] -- [[cqp:beyond-queries|Section 4]] -- [[cqp:expert-tricks|Section 5]] -- [[cqp:exercises|Section 6]] ]**