Is a name classed as a word

Every programmer agrees naming classes is highly important for code readability. Proper naming decrease the time needed to understand the code base. Many developers will also agree that class naming isn’t easy. There are numerous queries around the best practices which come not only from the beginners.

The aim of this article is to put in one place answers for the most popular questions around Java class name conventions and community standards. I’ll cover technical Java language restrictions, common conventions, and popular class naming best practices.

So much by way of introduction. Let’s get down into it.

Advertisement

Class name rules and restrictions

When it comes to technical limitations for class names, the Java language is pretty flexible. But realistically, programmers rarely use this flexibility.

Java class max length

The specification of the programming language states that the length of a Java class name is unlimited. In practice, however, the first limit comes from the JVM specification. For the current JVM it’s 65535 characters.

Moreover, the class name is usually the same as the filename in which you define the type. Because of that, there is one more factor affecting the max length of the class name. It’s Operating System and underlying filesystem.

In Windows, the limit for a single filename is 260 characters. The .java file extension takes 5 characters which leaves us with 255 character limit for class names. For UNIX based system most file systems also restrict the length of a file to 255 characters.

Characters allowed in Java class name

The language specification states that a class name should be a sequence of so-called Java letters or Java digits. The first character should be a Java letter.

What is a Java letter? Or Java digit?

A Java letter is a set of Unicode characters, underscore (_), and dollar sign ($). A Java digit is a collection of numbers from 0 to 9

The idea behind the Unicode characters as a valid part of Java class names is to allow programming in the native language of developers all over the world. However, this isn’t commonly practiced. Usually, programmers limit themselves to the English alphabet.

Once I’ve seen an app write in my native language and it was a pretty hilarious experience. Especially some plural variable names generated by IDE.

Java class name conventions and standards

Java is already a pretty old programming language. Over the years, developers created several commonly agreed standards for naming classes. These standards are much more restrictive than limitations from the Java language specification. Naming conventions allow other to read your code easily.

Please note almost all naming conventions are opinion based and not technically imposed. You may meet developers who disagree with some of the presented conventions (especially if they have a background in different programming languages). However, you definitely should discuss and agree on standards your team will follow inside a single project.

Below you can find the list of answers for the most popular questions around class naming conventions. If something in your opinion is missing on the list, please let me know about it in a comment.

Class name should be noun

In Object Oriented Programming, a class represents an existing entity from the real world that you model in your application. Classes describe things. Just think about classic examples like User, Message, or Event.

But single word class names are rather rare. Usually, we use noun phrases to provide more descriptive names for classes such as AnonymousUser, DirectMessage, or UserCreatedEvent. The less abstract a class is, the more details are present in its name.

You should reserve verbs for method names as they represent actions executed by things.

Singular or plural nouns?

When you think of a class as a template for objects, the choice should be obvious. In almost all cases objects we create represent singular entities. Just one item of something.

When we work with multiple instances, we usually use collections which are available in the Java Class Library. Collections always use singular nouns for their names. Think of List, Set, or Map to name a few. While working with multiple instances of some class, we usually manipulate them with some kind of singular container.

But hold on a second.

Don’t we have counterexamples inside JDK? What about classes like Objects, Arrays or Collections?

Unlike most classes we create, these JDK classes don’t represent any entities. What they all have in common is that you can’t create an instance of them. Try calling Objects constructor if you need proof. These types are just containers for static methods. These utility methods don’t belong to any particular instance.

On the other side of the coin, JDK has the String class which you can instantiate and which also contains static utility methods. It seems like an inconsistency in the design of JDK and maybe that’s why we’re all confused.

When it comes to static methods, it’s just a matter of choice. You can put such methods in a class with a singular name or create a plural named class as a namespace. As long as your team is consistent, you can’t go wrong with either option.

UserDao vs. UsersDao

The dilemma from the above subtitle is probably popular only amongst non-native English speaker (like myself). It extends on the previous point about singular and plural nouns in class names.

Imagine you have a class which manipulates multiple instances of some type, e.g. a repository class for the database access layer. Should you use a plural or a singular form of that type?

Let me answer the question with the picture:

Screwdriver

Do you know the English name of this tool?

It’s a screwdriver.

You can screw multiple screws with a screwdriver. Yet, in the name of the tool, there is only a singular screw. Can you see the analogy for the DAO class?

Class name same as filename

The Java compiler expects that the class name matches the filename in which it’s defined. However, this requirement is true only for public classes.

You technically can define a non-public class in a file with a different name or even write several classes in a single file. The Java compiler won’t prevent you from doing this.

But just because you can name files differently than classes, it doesn’t mean you should.

Java programmers commonly agree the class name and the filename should be the same. Having only a single class defined in a file is also considered as a standard. Such an approach is simpler for navigation around project’s file structure.

Class name starts with capital letter

As I already mentioned, a class name must start with a Java letter. The language specification sets this requirement. But, it doesn’t specify the case of this letter.

It’s just a common agreement amongst Java developers for easy readability of the code to start class names with a capitalized letter. When you create a class name with several words, you should capitalize each word. The upper case letter acts as a separator.

Can Java class name contain underscore?

Technically it’s possible to use the underscore in a class name, but there’s no practical reason to do so.

If the underscore were used in a class name, it would act as a separator between words. In Java, we achieve optical separation between words with the camel case. By using the underscore, we would only unnecessarily enlarged name’s length.

Class name length best practice

When a class name is too long?

A name of a class is too long when another shorter name with exactly the same meaning exists.

There’s no exact number which you should set in your static code analysis tool. The main aim of a class name is to describe the purpose of this class. The lesser short words you can use to name the class, the better for the code readability.

But why short names are so important?

Long names (not only of classes but method and variables too) affects the readability of code blocks. Vertical scroll bars in IDEs or simple line breaks are considered as distractors.

Our brain associates text lines with programming instructions. When an instruction spans multiple lines, many programmers find it hard to skim over code blocks.

Abbreviation in class name

The compiler only cares if names are unique. The code is written to be read by humans, not computers.

We already discussed short class names are important. Abbreviations seem like a way to achieve shorter names. Yet, most Java programmers prefer to avoid abbreviations.

However, some teams accept abbreviations for certain words. Especially, if these words appear in the numerous number of classes with similar purpose. An example of such word might be Config or Id. If your team belongs to this group, make sure all classes in a project follow the same rule.

Acronym in class name

An acronym is a word made from the first letters of other words. All letters in an acronym are capitalized, e.g. HTML.

Should an acronym be capitalized when used in a class name?

Unfortunately, if you check conventions in the Java Class Library, you’ll find examples for both approaches. Because of that, some people simply think it doesn’t really matter.
However, in Effective Java, Joshua Bloch suggests sticking to camel case also for acronyms. The example which illustrates benefits for readability is when a class name contains several acronyms next to each other, for instance HttpUrl. Using the upper case for both words would make the class name blurry and hard to read.

Blurry HTTP URL

Java class naming best practices

We already discussed technical restrictions and popular naming conventions. Now it’s time to present a handful of tips which should make naming classes easier for you.

Follow Single Responsibility Principle

The most important piece of advice you can ever get for Java class naming is to understand and apply the Single Responsibility Principle.

In brief, SRP tells us that a class should have only one reason to change. The name of a class should explain this reason.

Of course, SRP doesn’t only influence class naming. It changes the whole way you design your code. When you are new to SRP, it might seem odd and redundant to create numerous small classes. Fortunately, the more you practice SRP, the more benefits you’ll see.

Start with name placeholder

When you create a class and can’t come up with a name for it right away, give it a temporary name line ClassX and start implementing its body. Once you finish, the purpose of the class should be more obvious and naming shouldn’t be a problem.

But beware:

Without a name and a clear goal for a class, you can easily create a typical God object. If after implementation you still have a problem to name a class because it does several things, it might be a sign the class should be separated into a few smaller classes.

Avoid synonyms

It very common to have several classes which have the same purpose but in a different context. For example, let’s consider classes responsible for creating different objects. We can call such class as Creator, Constructor, or Factory.

The word you select to describe the purpose is a personal preference but keep the choice consistent across your whole application. Your team newcomers will thank you. It will be easier for them to see code conventions in the project at a glance.

Naming interface implementers

If you have an interface which is implemented only by one class and the name of this class is the same as interface’s name followed by the Impl suffix, you should be aware that something is wrong. It’s highly possible this interface is totally useless and the code would be much more readable with just a class named as this interface.

When a class implements an interface, it probably has specific traits that you can reflect in the name of this class. Just look at concrete implementations of the List interface from the Java Class Library. Names like ArrayList or LinkedList give you an overview of differences between them.

Conventions for naming service classes

Naming classes which model your domain objects is usually pretty straightforward. These names come from domain experts who know business very well. But these classes are just a small part of an application.

Yet, every application needs some glue code in which we create and manipulate aforementioned business objects. Such glue code usually resides in classes called Services.

Glue layer

You can find a lot of bad opinions about such service classes and numerous suggestions to avoid them.

But let’s be frank.

When you try to give a structure to your application, you can’t get rid of some sort of service classes. The name you choose for the glue layer doesn’t really matter. Service, Manager, Coordinator, sometimes Controller. Whatever. Pick your poison. You need a place in your application for coordinating work on business objects.

The general idea of service classes isn’t bad when you think of them as a glue layer. The problem with this type of service classes is at the pace they grow. Programmers tend to add way too many responsibilities to these classes which make them hard to maintain God objects.

The word Service is pretty generic and maybe that’s why developers assign so many responsibilities to these classes. But this word is used in our industry for so long that I don’t think it will ever change.

But there’s one thing we can improve.

We can split the responsibilities of service classes into smaller, better named and more focused classes. In other words, we apply the already discussed Single Responsibility Principle.

Util and helper class naming convention

Unfortunately, the Java Class Library doesn’t give us a clear guideline on naming utility method holders. Once again, the word you choose doesn’t really matter as long as you’re consistent inside your project.

Having classes called AccountUtils,  Accounts, and AccountUtilities will only confuse readers. Pick one convention and stick to it.

Conclusion

At this point, you should be familiar with the most popular Java naming conventions, standards, and best practices. We went through the technical restrictions, commonly agreed opinion based naming approaches, and finally covered a few class naming hints.

I strongly encourage you to leave a comment if you think something is missing on the list of mentioned topics. I’ll glad to extend the article to make it more accurate. Different opinions are also very welcome. If you find the post useful, don’t forget to spread the word.

Select your language

Suggested languages for you:

Illustration

Lerne mit deinen Freunden und bleibe auf dem richtigen Kurs mit deinen persönlichen Lernstatistiken

Jetzt kostenlos anmelden

Illustration

Words don’t only mean something; they also do something. In the English language, words are grouped into word classes based on their function, i.e. what they do in a phrase or sentence. In total, there are nine word classes in English.

Word class meaning and example

All words can be categorised into classes within a language based on their function and purpose.

An example of various word classes is ‘The cat ate a cupcake quickly.’

  • The = a determiner

  • cat = a noun

  • ate = a verb

  • a = determiner

  • cupcake = noun

  • quickly = an adverb

Word class function

The function of a word class, also known as a part of speech, is to classify words according to their grammatical properties and the roles they play in sentences. By assigning words to different word classes, we can understand how they should be used in context and how they relate to other words in a sentence.

Each word class has its own unique set of characteristics and rules for usage, and understanding the function of word classes is essential for effective communication in English. Knowing our word classes allows us to create clear and grammatically correct sentences that convey our intended meaning.

Word classes in English

In English, there are four main word classes; nouns, verbs, adjectives, and adverbs. These are considered lexical words, and they provide the main meaning of a phrase or sentence.

The other five word classes are; prepositions, pronouns, determiners, conjunctions, and interjections. These are considered functional words, and they provide structural and relational information in a sentence or phrase.

Don’t worry if it sounds a bit confusing right now. Read ahead and you’ll be a master of the different types of word classes in no time!

All word classes Definition Examples of word classification
Noun A word that represents a person, place, thing, or idea. cat, house, plant
Pronoun A word that is used in place of a noun to avoid repetition. he, she, they, it
Verb A word that expresses action, occurrence, or state of being. run, sing, grow
Adjective A word that describes or modifies a noun or pronoun. blue, tall, happy
Adverb A word that describes or modifies a verb, adjective, or other adverb. quickly, very
Preposition A word that shows the relationship between a noun or pronoun and other words in a sentence. in, on, at
Conjunction A word that connects words, phrases, or clauses. and, or, but
Interjection A word that expresses strong emotions or feelings. wow, oh, ouch
Determiners A word that clarifies information about the quantity, location, or ownership of the noun Articles like ‘the’ and ‘an’, and quantifiers like ‘some’ and ‘all’.

The four main word classes

In the English language, there are four main word classes: nouns, verbs, adjectives, and adverbs. Let’s look at all the word classes in detail.

Nouns

Nouns are the words we use to describe people, places, objects, feelings, concepts, etc. Usually, nouns are tangible (touchable) things, such as a table, a person, or a building.

However, we also have abstract nouns, which are things we can feel and describe but can’t necessarily see or touch, such as love, honour, or excitement. Proper nouns are the names we give to specific and official people, places, or things, such as England, Claire, or Hoover.

Cat

House

School

Britain

Harry

Book

Hatred

‘My sister went to school.

Verbs

Verbs are words that show action, event, feeling, or state of being. This can be a physical action or event, or it can be a feeling that is experienced.

Lexical verbs are considered one of the four main word classes, and auxiliary verbs are not. Lexical verbs are the main verb in a sentence that shows action, event, feeling, or state of being, such as walk, ran, felt, and want, whereas an auxiliary verb helps the main verb and expresses grammatical meaning, such as has, is, and do.

Run

Walk

Swim

Curse

Wish

Help

Leave

‘She wished for a sunny day.’

Adjectives

Adjectives are words used to modify nouns, usually by describing them. Adjectives describe an attribute, quality, or state of being of the noun.

Long

Short

Friendly

Broken

Loud

Embarrassed

Dull

Boring

‘The friendly woman wore a beautiful dress.’

Word class, Image of woman in dress, StudySmarterFig 1. Adjectives can describe the woman and the dress

Adverbs

Adverbs are words that work alongside verbs, adjectives, and other adverbs. They provide further descriptions of how, where, when, and how often something is done.

Quickly

Softly

Very

More

Too

Loudly

The music was too loud.’

All of the above examples are lexical word classes and carry most of the meaning in a sentence. They make up the majority of the words in the English language.

The other five word classes

The other five remaining word classes are; prepositions, pronouns, determiners, conjunctions, and interjections. These words are considered functional words and are used to explain grammatical and structural relationships between words.

For example, prepositions can be used to explain where one object is in relation to another.

Prepositions

Prepositions are used to show the relationship between words in terms of place, time, direction, and agency.

In

At

On

Towards

To

Through

Into

By

With

They went through the tunnel.’

Pronouns

Pronouns take the place of a noun or a noun phrase in a sentence. They often refer to a noun that has already been mentioned and are commonly used to avoid repetition.

Chloe (noun) → she (pronoun)

Chloe’s dog → her dog (possessive pronoun)

There are several different types of pronouns; let’s look at some examples of each.

  • He, she, it, they — personal pronouns
  • His, hers, its, theirs, mine, ours — possessive pronouns
  • Himself, herself, myself, ourselves, themselves — reflexive pronouns
  • This, that, those, these — demonstrative pronouns
  • Anyone, somebody, everyone, anything, something — Indefinite pronouns
  • Which, what, that, who, who — Relative pronouns

She sat on the chair which was broken.’

Determiners

Determiners work alongside nouns to clarify information about the quantity, location, or ownership of the noun. It ‘determines’ exactly what is being referred to. Much like pronouns, there are also several different types of determiners.

  • The, a, an — articles
  • This, that, those — you might recognise these for demonstrative pronouns are also determiners
  • One, two, three etc. — cardinal numbers
  • First, second, third etc. — ordinal numbers
  • Some, most, all — quantifiers
  • Other, another — difference words

The first restaurant is better than the other.’

Conjunctions

Conjunctions are words that connect other words, phrases, and clauses together within a sentence. There are three main types of conjunctions;

  • Coordinating conjunctions — these link independent clauses together.

  • Subordinating conjunctions — these link dependent clauses to independent clauses.

  • Correlative conjunctions — words that work in pairs to join two parts of a sentence of equal importance.

For, and, nor, but, or, yet, so — coordinating conjunctions

After, as, because, when, while, before, if, even though — subordinating conjunctions

Either/or, neither/nor, both/and — correlative conjunctions

If it rains, I’m not going out.’

Interjections

Interjections are exclamatory words used to express an emotion or a reaction. They often stand alone from the rest of the sentence and are accompanied by an exclamation mark.

Oh

Oops!

Phew!

Ahh!

Oh, what a surprise!’

Word class: lexical classes and function classes

A helpful way to understand lexical word classes is to see them as the building blocks of sentences. If the lexical word classes are the blocks themselves, then the function word classes are the cement holding the words together and giving structure to the sentence.

Word class, lexical class, functional class, StudySmarterFig 2. Lexical and functional word classes

In this diagram, the lexical classes are in blue and the function classes are in yellow. We can see that the words in blue provide the key information, and the words in yellow bring this information together in a structured way.

Word class examples

Sometimes it can be tricky to know exactly which word class a word belongs to. Some words can function as more than one word class depending on how they are used in a sentence. For this reason, we must look at words in context, i.e. how a word works within the sentence. Take a look at the following examples of word classes to see the importance of word class categorisation.

The dog will bark if you open the door.

The tree bark was dark and rugged.

Here we can see that the same word (bark) has a different meaning and different word class in each sentence. In the first example, ‘bark’ is used as a verb, and in the second as a noun (an object in this case).

I left my sunglasses on the beach.

The horse stood on Sarah’s left foot.

In the first sentence, the word ‘left’ is used as a verb (an action), and in the second, it is used to modify the noun (foot). In this case, it is an adjective.

I run every day

I went for a run

In this example, ‘run’ can be a verb or a noun.

Word Class — Key takeaways

  • We group words into word classes based on the function they perform in a sentence.

  • The four main word classes are nouns, adjectives, verbs, and adverbs. These are lexical classes that give meaning to a sentence.

  • The other five word classes are prepositions, pronouns, determiners, conjunctions, and interjections. These are function classes that are used to explain grammatical and structural relationships between words.

  • It is important to look at the context of a sentence in order to work out which word class a word belongs to.

Frequently Asked Questions about Word Class

A word class is a group of words that have similar properties and play a similar role in a sentence.

Some examples of how some words can function as more than one word class include the way ‘run’ can be a verb (‘I run every day’) or a noun (‘I went for a run’). Similarly, ‘well’ can be an adverb (‘He plays the guitar well’) or an adjective (‘She’s feeling well today’). 

The nine word classes are; Nouns, adjectives, verbs, adverbs, prepositions, pronouns, determiners, conjunctions, interjections.

Categorising words into word classes helps us to understand the function the word is playing within a sentence.

Parts of speech is another term for word classes.

The different groups of word classes include lexical classes that act as the building blocks of a sentence e.g. nouns. The other word classes are function classes that act as the ‘glue’ and give grammatical information in a sentence e.g. prepositions.

The word classes for all, that, and the is:
‘All’ = determiner (quantifier)
‘That’ = pronoun and/or determiner (demonstrative pronoun)
‘The’ = determiner (article)

Final Word Class Quiz

Word Class Quiz — Teste dein Wissen

Question

A word can only belong to one type of noun. True or false?

Show answer

Answer

This is false. A word can belong to multiple categories of nouns and this may change according to the context of the word.

Show question

Question

Name the two principal categories of nouns.

Show answer

Answer

The two principal types of nouns are ‘common nouns’ and ‘proper nouns’.

Show question

Question

Which of the following is an example of a proper noun?

Show answer

Question

Name the 6 types of common nouns discussed in the text.

Show answer

Answer

Concrete nouns, abstract nouns, countable nouns, uncountable nouns, collective nouns, and compound nouns.

Show question

Question

What is the difference between a concrete noun and an abstract noun?

Show answer

Answer

A concrete noun is a thing that physically exists. We can usually touch this thing and measure its proportions. An abstract noun, however, does not physically exist. It is a concept, idea, or feeling that only exists within the mind.

Show question

Question

Pick out the concrete noun from the following:

Show answer

Question

Pick out the abstract noun from the following:

Show answer

Question

What is the difference between a countable and an uncountable noun? Can you think of an example for each?

Show answer

Answer

A countable noun is a thing that can be ‘counted’, i.e. it can exist in the plural. Some examples include ‘bottle’, ‘dog’ and ‘boy’. These are often concrete nouns. 

An uncountable noun is something that can not be counted, so you often cannot place a number in front of it. Examples include ‘love’, ‘joy’, and ‘milk’.

Show question

Question

Pick out the collective noun from the following:

Show answer

Question

What is the collective noun for a group of sheep?

Show answer

Answer

The collective noun is a ‘flock’, as in ‘flock of sheep’.

Show question

Question

The word ‘greenhouse’ is a compound noun. True or false?

Show answer

Answer

This is true. The word ‘greenhouse’ is a compound noun as it is made up of two separate words ‘green’ and ‘house’. These come together to form a new word.

Show question

Question

What are the adjectives in this sentence?: ‘The little boy climbed up the big, green tree’

Show answer

Answer

The adjectives are ‘little’ and ‘big’, and ‘green’ as they describe features about the nouns.

Show question

Question

Place the adjectives in this sentence into the correct order: the wooden blue big ship sailed across the Indian vast scary ocean.

Show answer

Answer

The big, blue, wooden ship sailed across the vast, scary, Indian ocean.

Show question

Question

What are the 3 different positions in which an adjective can be placed?

Show answer

Answer

An adjective can be placed before a noun (pre-modification), after a noun (post-modification), or following a verb as a complement.

Show question

Question

In this sentence, does the adjective pre-modify or post-modify the noun? ‘The unicorn is angry’.

Show answer

Answer

The adjective ‘angry’ post-modifies the noun ‘unicorn’.

Show question

Question

In this sentence, does the adjective pre-modify or post-modify the noun? ‘It is a scary unicorn’.

Show answer

Answer

The adjective ‘scary’ pre-modifies the noun ‘unicorn’.

Show question

Question

What kind of adjectives are ‘purple’ and ‘shiny’?

Show answer

Answer

‘Purple’ and ‘Shiny’ are qualitative adjectives as they describe a quality or feature of a noun

Show question

Question

What kind of adjectives are ‘ugly’ and ‘easy’?

Show answer

Answer

The words ‘ugly’ and ‘easy’ are evaluative adjectives as they give a subjective opinion on the noun.

Show question

Question

Which of the following adjectives is an absolute adjective?

Show answer

Question

Which of these adjectives is a classifying adjective?

Show answer

Question

Convert the noun ‘quick’ to its comparative form.

Show answer

Answer

The comparative form of ‘quick’ is ‘quicker’.

Show question

Question

Convert the noun ‘slow’ to its superlative form.

Show answer

Answer

The comparative form of ‘slow’ is ‘slowest’.

Show question

Question

What is an adjective phrase?

Show answer

Answer

An adjective phrase is a group of words that is ‘built’ around the adjective (it takes centre stage in the sentence). For example, in the phrase ‘the dog is big’ the word ‘big’ is the most important information.

Show question

Question

Give 2 examples of suffixes that are typical of adjectives.

Show answer

Answer

Suffixes typical of adjectives include -able, -ible, -ful, -y, -less, -ous, -some, -ive, -ish, -al.

Show question

Question

What is the difference between a main verb and an auxiliary verb?

Show answer

Answer

A main verb is a verb that can stand on its own and carries most of the meaning in a verb phrase. For example, ‘run’, ‘find’. Auxiliary verbs cannot stand alone, instead, they work alongside a main verb and ‘help’ the verb to express more grammatical information e.g. tense, mood, possibility.

Show question

Question

What is the difference between a primary auxiliary verb and a modal auxiliary verb?

Show answer

Answer

Primary auxiliary verbs consist of the various forms of ‘to have’, ‘to be’, and ‘to do’ e.g. ‘had’, ‘was’, ‘done’. They help to express a verb’s tense, voice, or mood. Modal auxiliary verbs show possibility, ability, permission, or obligation. There are 9 auxiliary verbs including ‘could’, ‘will’, might’.

Show question

Question

Which of the following are primary auxiliary verbs?

  • Is

  • Play

  • Have

  • Run

  • Does

  • Could

Show answer

Answer

The primary auxiliary verbs in this list are ‘is’, ‘have’, and ‘does’. They are all forms of the main primary auxiliary verbs ‘to have’, ‘to be’, and ‘to do’. ‘Play’ and ‘run’ are main verbs and ‘could’ is a modal auxiliary verb.

Show question

Question

Name 6 out of the 9 modal auxiliary verbs.

Show answer

Answer

Answers include: Could, would, should, may, might, can, will, must, shall

Show question

Question

‘The fairies were asleep’. In this sentence, is the verb ‘were’ a linking verb or an auxiliary verb?

Show answer

Answer

The word ‘were’ is used as a linking verb as it stands alone in the sentence. It is used to link the subject (fairies) and the adjective (asleep).

Show question

Question

What is the difference between dynamic verbs and stative verbs?

Show answer

Answer

A dynamic verb describes an action or process done by a noun or subject. They are thought of as ‘action verbs’ e.g. ‘kick’, ‘run’, ‘eat’. Stative verbs describe the state of being of a person or thing. These are states that are not necessarily physical action e.g. ‘know’, ‘love’, ‘suppose’.

Show question

Question

Which of the following are dynamic verbs and which are stative verbs?

  • Drink

  • Prefer

  • Talk

  • Seem

  • Understand

  • Write

Show answer

Answer

The dynamic verbs are ‘drink’, ‘talk’, and ‘write’ as they all describe an action. The stative verbs are ‘prefer’, ‘seem’, and ‘understand’ as they all describe a state of being.

Show question

Question

What is an imperative verb?

Show answer

Answer

Imperative verbs are verbs used to give orders, give instructions, make a request or give warning. They tell someone to do something. For example, ‘clean your room!’.

Show question

Question

Inflections give information about tense, person, number, mood, or voice. True or false?

Show answer

Question

What information does the inflection ‘-ing’ give for a verb?

Show answer

Answer

The inflection ‘-ing’ is often used to show that an action or state is continuous and ongoing.

Show question

Question

How do you know if a verb is irregular?

Show answer

Answer

An irregular verb does not take the regular inflections, instead the whole word is spelt a different way. For example, begin becomes ‘began’ or ‘begun’. We can’t add the regular past tense inflection -ed as this would become ‘beginned’ which doesn’t make sense.

Show question

Question

Suffixes can never signal what word class a word belongs to. True or false?

Show answer

Answer

False. Suffixes can signal what word class a word belongs to. For example, ‘-ify’ is a common suffix for verbs (‘identity’, ‘simplify’)

Show question

Question

A verb phrase is built around a noun. True or false?

Show answer

Answer

False. A verb phrase is a group of words that has a main verb along with any other auxiliary verbs that ‘help’ the main verb. For example, ‘could eat’ is a verb phrase as it contains a main verb (‘could’) and an auxiliary verb (‘could’).

Show question

Question

Which of the following are multi-word verbs? 

  • Shake

  • Rely on

  • Dancing

  • Look up to

Show answer

Answer

The verbs ‘rely on’ and ‘look up to’ are multi-word verbs as they consist of a verb that has one or more prepositions or particles linked to it.

Show question

Question

What is the difference between a transition verb and an intransitive verb?

Show answer

Answer

Transitive verbs are verbs that require an object in order to make sense. For example, the word ‘bring’ requires an object that is brought (‘I bring news’). Intransitive verbs do not require an object to complete the meaning of the sentence e.g. ‘exist’ (‘I exist’).

Show question

Answer

An adverb is a word that gives more information about a verb, adjective, another adverb, or a full clause.

Show question

Question

What are the 3 ways we can use adverbs?

Show answer

Answer

We can use adverbs to modify a word (modifying adverbs), to intensify a word (intensifying adverbs), or to connect two clauses (connecting adverbs).

Show question

Question

What are modifying adverbs?

Show answer

Answer

Modifying adverbs are words that modify verbs, adjectives, or other adverbs. They add further information about the word.

Show question

Question

‘Additionally’, ‘likewise’, and ‘consequently’ are examples of connecting adverbs. True or false?

Show answer

Answer

True! Connecting adverbs are words used to connect two independent clauses.

Show question

Question

What are intensifying adverbs?

Show answer

Answer

Intensifying adverbs are words used to strengthen the meaning of an adjective, another adverb, or a verb. In other words, they ‘intensify’ another word.

Show question

Question

Which of the following are intensifying adverbs?

  • Calmly

  • Incredibly

  • Enough

  • Greatly

Show answer

Answer

The intensifying adverbs are ‘incredibly’ and ‘greatly’. These strengthen the meaning of a word.

Show question

Question

Name the main types of adverbs

Show answer

Answer

The main adverbs are; adverbs of place, adverbs of time, adverbs of manner, adverbs of frequency, adverbs of degree, adverbs of probability, and adverbs of purpose.

Show question

Question

What are adverbs of time?

Show answer

Answer

Adverbs of time are the ‘when?’ adverbs. They answer the question ‘when is the action done?’ e.g. ‘I’ll do it tomorrow

Show question

Question

Which of the following are adverbs of frequency?

  • Usually

  • Patiently

  • Occasionally

  • Nowhere

Show answer

Answer

The adverbs of frequency are ‘usually’ and ‘occasionally’. They are the ‘how often?’ adverbs. They answer the question ‘how often is the action done?’. 

Show question

Question

What are adverbs of place?

Show answer

Answer

Adverbs of place are the ‘where?’ adverbs. They answer the question ‘where is the action done?’. For example, ‘outside’ or ‘elsewhere’.

Show question

Question

Which of the following are adverbs of manner?

  • Never

  • Carelessly

  • Kindly

  • Inside

Show answer

Answer

The words ‘carelessly’ and ‘kindly’ are adverbs of manner. They are the ‘how?’ adverbs that answer the question ‘how is the action done?’. 

Show question

Discover the right content for your subjects

No need to cheat if you have everything you need to succeed! Packed into one app!

Study Plan

Be perfectly prepared on time with an individual plan.

Quizzes

Test your knowledge with gamified quizzes.

Flashcards

Create and find flashcards in record time.

Notes

Create beautiful notes faster than ever before.

Study Sets

Have all your study materials in one place.

Documents

Upload unlimited documents and save them online.

Study Analytics

Identify your study strength and weaknesses.

Weekly Goals

Set individual study goals and earn points reaching them.

Smart Reminders

Stop procrastinating with our study reminders.

Rewards

Earn points, unlock badges and level up while studying.

Magic Marker

Create flashcards in notes completely automatically.

Smart Formatting

Create the most beautiful study materials using our templates.

Sign up to highlight and take notes. It’s 100% free.

This website uses cookies to improve your experience. We’ll assume you’re ok with this, but you can opt-out if you wish. Accept

Privacy & Cookies Policy

Other software developers in the field of Bioinformatics might be interested in a solution of this problem, so I post here my approach as suggested by Alasdair.

The goal is to create a model for a living species, for the sake of simplicity let’s say an animal, and create an endpoint with Django REST Framework representing the correct taxonomic ranks.

models.py

from django.db import models

class Animal(models.Model):
    canonical_name = models.CharField(max_length=100, unique=True)
    species = models.CharField(max_length=60, unique=True)
    genus = models.CharField(max_length=30)
    family = models.CharField(max_length=30)
    order = models.CharField(max_length=30)
    # we can't use class as field name
    class_name = models.CharField('Class', db_column='class', max_length=30)
    phylum = models.CharField(max_length=30)
    # we don't need to define kingdom and domain
    # it's clear that it is an animal and eukaryote

    def __str__(self):
        return '{} ({})'.format(self.canonical_name, self.species)

serializers.py

from collections import OrderedDict

from rest_framework import serializers

from .models import Species

class SpeciesSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Animal
        fields = ('url', 'id', 'canonical_name', 'species', 'genus',
            'subfamily', 'family', 'order', 'class_name', 'phylum')

    def to_representation(self, obj):
        # call the parent method and get an OrderedDict
        data = super(SpeciesSerializer, self).to_representation(obj)
        # generate a list of the keys and replace the key 'class_name'
        keys = list(data.keys())
        keys.insert(keys.index('class_name'), 'class')
        keys.remove('class_name')
        # remove 'class_name' and assign its value to a new key 'class'
        class_name = data.pop('class_name')
        data.update({'class': class_name})
        # create new OrderedDict with the order given by the keys
        response = OrderedDict((k, data[k]) for k in keys)
        return response

The method to_representation helps us to manipulate the output. I have put some extra work here to get the taxonomic ranks in the desired order.

Thus for the red fox the output looks like this:

Red fox (Vulpes vulpes)

{
    "url": "http://localhost:8000/animal/1",
    "id": 1,
    "canonical_name": "Red fox",
    "species": "Vulpes vulpes",
    "genus": "Vulpes",
    "family": "Canidae",
    "order": "Carnivora",
    "class": "Mammalia",
    "phylum": "Chordata"
}

It is a simplified example and in reality you’d have many more fields or possibly a model for every taxonomic rank, but somewhere you might come across the conflict between the reserved word class and the taxonomic rank class.
I hope this can help other people too.

Words are the building blocks in any sentence. They just don’t ‘mean’ something, they ‘do’ something in every sentence. Hence words are grouped into word classes based on what they do. A word class is a group of words that have certain common features. The term “word class” is analogous to the more conventional term, “part of speech.” It is also variously named grammatical category, lexical category, and syntactic category.

  • Types of Word Classes
  • Open and Closed Word Classes
  • Open Word Classes
  • Closed Word Classes
  • How to identify the word classes in a sentence?
  • How to classify a word class?
  • What is the difference between a word class and part of speech?

Word classes can be divided into two families:

  • Lexical Classes: Also known as open classes and form classes. The lexical classes include nouns, verbs, adjectives, and adverbs.
  • Function Classes: Also known as closed classes and structure classes. Includes: pronouns, determiners, conjunctions, prepositions, and interjections.

Open and Closed Word Classes

As previously mentioned some word classes are open, that is, the class can be expanded with the addition of new words. Take the example of the class of nouns, it is potentially infinite as the number of words in the class is increasing as new scientific and technological discoveries are made.

The latter half of the twentieth century witnessed developments in computer technology which have in turn given rise to many new nouns like the Internet, URL website, bitmap, email, etc.

On the other hand, the word classes of prepositions, determiners, or conjunctions are known as closed word classes. Words like of, the, and but come under these. They are named closed word classes because they consist of a definite set of words. These classes never expand even though the words included in the class may change their spelling.

Open Word Classes

1) Nouns

This class includes words that you frequently use in everyday life. Nouns are most commonly understood as “naming” words, that is, it performs the function of naming “people, places or things”.

  • A person – Boy, Girl, John, etc
  • A thing- House, Dog, etc
  • A place- China, America, etc

However, the use of nouns is not restricted to just names of people, places, or things. Nouns also denote abstract and intangible concepts such as an idea, quality, or state. Example: Danger, Happiness, Love, etc.

2) Verbs

The words that you use to describe an action are known as verbs. Hence verbs are generally known as “action” words. Have a look at the given example: Rahul rides a scooter. The verb in the above sentence denotes an action that Rahul performs which is the action of riding a scooter.

However, the idea of verbs as “action” words is somewhat restricted. Many verbs don’t stand for action at all as in the given instance: Rahul seems desperate. We cannot say that the verb ‘seems ‘ refer to an action.

3) Adverbs

In English, an adverb describes a word that alters the meaning of a verb, adjective, or another adverb. Adverbs in a sentence give you more information about the sentence. They are used to express how an action is fulfilled. Adverbs can broadly be categorized into Simple Adverbs, IInterrogative adverbs, and Relative Adverbs.

Remember:

  • Most adverbs end with the common ending – ly.
  • An adverb that modifies an adjective or another adverb usually goes before it.

4) Adjectives

Adjectives describe the quality of a noun. For example They stay in a beautiful house

The word beautiful indicates or refers to one of the attributes of the house that is described. Hence beautiful becomes the adjective in the above sentence.

A point to keep in mind: Some adjectives can be identified by their ending. Typical adjective endings include: able, al, ful, ic, etc.

You can even try out our other articles on How to Improve Your Vocabulary as well to expand your knowledge base.

Closed Word Classes

1) Determiners

You might have often noticed that nouns are preceded by words like the, a, or an. These words are known as Determiners. They suggest the type of reference that the noun has.

  • The determiner ‘the’ is called a Definite Article. It can be placed both before singular and plural nouns. For example The Taxi, The taxis
  • The determiner a or an is known as the Indefinite Article. It is used along with a singular noun. Example: A taxi

Apart from these, many other determiners express quantity. These include ‘al’, ‘both’, ‘many’ etc.

2) Conjunctions

These are used to express connections between different words.

Example: John and David are friends. And is used as a conjunction in the given sentence.
The most familiar conjunctions in English are: and, but, and or.

Conjunctions are further divided into two:

  • Coordinating Conjunctions: These conjunctions connect elements of equal syntactic structure. Example: Paul and David study together.
  • Subordinating Conjunctions: Connects elements of unequal syntactic structure. Example: I left early because I had an interview the next day.

3) Prepositions

Prepositions indicate the relation between different words. They occur before a noun, pronoun, or noun phrase and indicate a direction, time, place, location, and spatial relationship. Common prepositions include across, after, at, before, by, during, from, in, into, of, on, to, under, with, without, etc.

4) Pronouns

If we did not have the pronoun word families we would have to repeat a whole lot of nouns. A word that takes the position of a noun is named as a pronoun. Pronouns can be employed as a substitute for a noun.

  • Pronouns are divided into 5 categories:
  • Personal Pronouns: I, you, she, etc
  • Demonstrative Pronouns: This, these, etc
  • Possessive Pronouns: Yours, His, etc
  • Interrogative Pronouns: Which, What, etc
  • Reflexive Pronouns: Herself, Himself, etc.
  • Reciprocal Pronouns: Each other
  • Indefinite Pronouns: Few, Nobody, etc.
  • Relative Pronouns: Which, Whom, etc.

5) Interjections

Short exclamations like Oh!, Ah! etc are known as Interjections. Even though they have no grammatical value, we often use them in daily speech. Interjections are primarily used to express emotions such as anger, surprise, etc. Given below are a few examples.

Well! That hurts
Hey! Don’t be so clumsy

Remember, an interjection is always followed by an exclamation mark.

Read More:

  • English Idioms
  • Literary Devices

FAQs on Word Classes

1. How to identify the word classes in a sentence?

A word class is a group of words that have certain common features. To find out the word classes within a sentence it is important that you familiarise yourself with the most common word classes in English. These include nouns, adjectives, verbs, adverbs, prepositions, etc.

2. How to classify a word class?

Word classes in English belong to two major categories. These are Open word classes that include nouns, verbs, adjectives, and adverbs. The second category is closed word classes that include: pronouns, determiners, interjections, etc.

3. What is the difference between a word class and part of speech?

The term “word class” is analogous to the more conventional term, “part of speech”. Both these terms refer to a group of words that have certain common features.

Conclusion

To understand the grammatical structures of sentences in a better way it’s best if you begin with word classes. Even though comprehending the different word classes may initially be a hectic task, once you master word classes, you will reach the exact meaning or message conveyed by a sentence.

The words
of language, depending on various formal and semantic features,
are divided into grammatically relevant sets or classes. The
tra­ditional grammatical classes of words are called «parts
of speech». Since the
word is distinguished not only by grammatical, but also by
semantico-lexemic properties, some scholars refer to parts of speech
as «lexico-grammatical»
series of words, or as «lexico-grammatical categories.

It
should be noted that the term «part of speech» is purely
traditional and
conventional, it cannot be taken as in any way defining or
explana­tory. This name was introduced in the grammatical
teaching of Ancient Greece, where the concept of the sentence was not
yet explicitly identi­fied
in distinction to the general idea of speech, and where,
consequently, no
strict differentiation was drawn between the word as a vocabulary
unit and the word as a functional element of the sentence.

In
modern linguistics, parts of speech are discriminated on the basis of
the three
criteria
:
«semantic»,
«formal», and «functional»
.

The
se­mantic
criterion
presupposes the evaluation of the generalized meaning, which
is characteristic of all the subsets of words constituting a given
part of speech. This meaning is understood as the «categorial
meaning of
the part of speech».

The
formal
criterion
provides for the exposition of the
specific inflexional and derivational (word-building) features of
allthe
lexemic subsets of a part of speech.

The
functional
criterion
concerns the
syntactic role of words in the sentence typical of a part of speech.
The said
three factors of categorial characterization of words are
conven­tionally
referred to as, respectively, «meaning», «form»,
and «function».

In accord
with the described criteria, words on the upper level of
classification
are divided into notional
and functional,
which reflects their division
in the earlier grammatical tradition into changeable and
un­changeable.

To the
notional
parts of speech

of the English language belong the noun, the adjective, the numeral,
the pronoun, the verb, the adverb.

Contrasted against the
notional parts of speech are words of incom­plete nominative
meaning and non-self-dependent, mediatory functions in the sentence.
These are functional parts of speech.

To
the basic functional
series of words

in English belong the article, the
preposition, the conjunction, the particle, the modal word, the
inter­jection.

Each part of speech after its
identification is further subdivided into subseries in accord with
various particular semantico-functional and formal features of the
constituent words. This subdivision is some­times called
«subcategorization» of parts of speech.

Thus, nouns
are subcategorized into proper and common, ani­mate and
inanimate, countable and uncountable, concrete and ab­stract,
etc.

Verbs
are subcategorized into fully predicative and partially pred­icative,
transitive and intransitive, actional and statal, purely nomi­native
and evaluative, etc.

Adjectives
are subcategorized into qualitative and relative, of con­stant
feature and temporary feature (the latter are referred to as
«statives» and identified by some scholars as a separate
part of speech un­der the heading of «category of state»),
factual and evaluative, etc.

The adverb,
the numeral, the pronoun are also subject to the cor­responding
subcategorizations.

We have
drawn a general outline of the division of the lexicon into part
of speech classes developed by modern linguists on the lines of
tra­ditional
morphology.

Alongside
the three-criteria principle of dividing the words into grammatical
(lexico-grammatical) classes, modern linguistics has de­veloped
another, narrower principle
of word-class identification based on syntactic featuring of words

only.

The fact is
that the three-criteria principle faces a special difficulty in
determining the part of speech status of such lexemes as have
mor­phological characteristics of notional words, but are
essentially distin­guished from notional words by their playing
the role of grammatical mediators in phrases and sentences. Here
belong, for instance, modal verbs
together with their equivalents — suppletive fillers, auxiliary
verbs, aspective
verbs, intensifying adverbs, determiner pronouns. This diffi­culty,
consisting in the intersection of heterogeneous properties in the
established
word-classes, can evidently be overcome by recognizing only one
criterion of the three as decisive.

Comparing
the syntactico-distributional classification of words with the
traditional part of speech division of words, one cannot but see the
similarity of the general schemes of the two: the opposition of
notional and
functional words, the four absolutely cardinal classes of notional
words (since numerals and pronouns have no positional functions of
their
own and serve as pro-nounal and pro-adjectival elements), the
in­terpretation of functional words as syntactic mediators and
their formal representation
by the list.

However,
under these unquestionable traits of similarity are distinctly
revealed
essential features of difference, the proper evaluation of which
allows us to make some important generalizations about the structure
of the
lexemic system of language.

As
a result of the undertaken analysis

we have obtained a founda­tion
for dividing the whole of the lexicon at the upper level of
classifica­tion
into three unequal parts.

The
first part of the lexicon forming an open set includes an
indefi­nitely large number of notional words which have a
complete nomina­tive
function. In accord with the said function, these words can be re
ferred to as «names»: nouns as substance names, verbs as
process names, adjectives
as primary property names and adverbs as secondary proper­ty
names. The whole notional set is represented by the four-stage
deriva­tional
paradigm of nomination.

The
second part of the lexicon forming a closed set includes substi­tutes
of names (pro-names). Here belong pronouns, and also broad-mean­ing
notional words which constitute various marginal subsets.

The
third part of the lexicon also forming a closed set includes
spec­ifiers
of names. These are function-categorial words of various
servo-status.

Substitutes
of names (pro-names) and specifiers of names, while stand­ing
with the names in nominative correlation as elements of the lexicon,
at
the same time serve as connecting links between the names within the
lexicon
and their actual uses in the sentences of living speech.

ЛИТЕРАТУРА:

  1. Блох, М.Я.
    Теоретическая грамматика английского
    языка : Учеб. / М.Я. Блох. – 5–е изд.,
    стер. – М. : Высш. шк., 2006. – 423 с.

  2. Блох, М.Я.
    Теоретические основы грамматики :
    учеб. / М.Я. Блох. – 3–е изд., испр. –
    М. : Высш. шк., 2002. – 160 с.

  3. Blokh,
    M.Y. A course in theoretical English grammar / M.Y. Blokh. –
    M., 1983.

6

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]

  • #
  • #
  • #
  • #
  • #
  • #
  • #
  • #
  • #
  • #
  • #

In English grammar, a word class is a set of words that display the same formal properties, especially their inflections and distribution. The term «word class» is similar to the more traditional term, part of speech. It is also variously called grammatical category, lexical category, and syntactic category (although these terms are not wholly or universally synonymous).

The two major families of word classes are lexical (or open or form) classes (nouns, verbs, adjectives, adverbs) and function (or closed or structure) classes (determiners, particles, prepositions, and others).

Examples and Observations

  • «When linguists began to look closely at English grammatical structure in the 1940s and 1950s, they encountered so many problems of identification and definition that the term part of speech soon fell out of favor, word class being introduced instead. Word classes are equivalent to parts of speech, but defined according to strict linguistic criteria.» (David Crystal, The Cambridge Encyclopedia of the English Language, 2nd ed. Cambridge University Press, 2003)
  • «There is no single correct way of analyzing words into word classes…Grammarians disagree about the boundaries between the word classes (see gradience), and it is not always clear whether to lump subcategories together or to split them. For example, in some grammars…pronouns are classed as nouns, whereas in other frameworks…they are treated as a separate word class.» (Bas Aarts, Sylvia Chalker, Edmund Weiner, The Oxford Dictionary of English Grammar, 2nd ed. Oxford University Press, 2014)

Form Classes and Structure Classes

«[The] distinction between lexical and grammatical meaning determines the first division in our classification: form-class words and structure-class words. In general, the form classes provide the primary lexical content; the structure classes explain the grammatical or structural relationship. Think of the form-class words as the bricks of the language and the structure words as the mortar that holds them together.»

The form classes also known as content words or open classes include:

  • Nouns
  • Verbs
  • Adjectives
  • Adverbs

The structure classes, also known as function words or closed classes, include:

  • Determiners
  • Pronouns
  • Auxiliaries
  • Conjunctions
  • Qualifiers
  • Interrogatives
  • Prepositions
  • Expletives
  • Particles

«Probably the most striking difference between the form classes and the structure classes is characterized by their numbers. Of the half million or more words in our language, the structure words—with some notable exceptions—can be counted in the hundreds. The form classes, however, are large, open classes; new nouns and verbs and adjectives and adverbs regularly enter the language as new technology and new ideas require them.» (Martha Kolln and Robert Funk, Understanding English Grammar. Allyn and Bacon, 1998)

One Word, Multiple Classes

«Items may belong to more than one class. In most instances, we can only assign a word to a word class when we encounter it in context. Looks is a verb in ‘It looks good,’ but a noun in ‘She has good looks‘; that is a conjunction in ‘I know that they are abroad,’ but a pronoun in ‘I know that‘ and a determiner in ‘I know that man’; one is a generic pronoun in ‘One must be careful not to offend them,’ but a numeral in ‘Give me one good reason.'» (Sidney Greenbaum, Oxford English Grammar. Oxford University Press, 1996)

Suffixes as Signals

«We recognize the class of a word by its use in context. Some words have suffixes (endings added to words to form new words) that help to signal the class they belong to. These suffixes are not necessarily sufficient in themselves to identify the class of a word. For example, -ly is a typical suffix for adverbs (slowly, proudly), but we also find this suffix in adjectives: cowardly, homely, manly. And we can sometimes convert words from one class to another even though they have suffixes that are typical of their original class: an engineer, to engineer; a negative response, a negative(Sidney Greenbaum and Gerald Nelson, An Introduction to English Grammar, 3rd ed. Pearson, 2009)

A Matter of Degree

«[N]ot all the members of a class will necessarily have all the identifying properties. Membership in a particular class is really a matter of degree. In this regard, grammar is not so different from the real world. There are prototypical sports like ‘football’ and not so sporty sports like ‘darts.’ There are exemplary mammals like ‘dogs’ and freakish ones like the ‘platypus.’ Similarly, there are good examples of verbs like watch and lousy examples like beware; exemplary nouns like chair that display all the features of a typical noun and some not so good ones like Kenny (Kersti Börjars and Kate Burridge, Introducing English Grammar, 2nd ed. Hodder, 2010)

Continue Learning about English Language Arts

Is birdseed one or two words?

Its classed as one word


What word class is the word something?

«Something» is classed as a pronoun, and to be more precise, a
compound pronoun. Pronouns are used instead of nouns, noun phrases
and noun clauses; in this instant, the word «something» is
represnting an event, that is, a noun.


Is ‘y’ classed as a vowel?

Y may serve as a vowel, a semi-vowel or a consonant. In the word by, it is a vowel; in hay it is a semi-vowel; in yes it is a consonant.


Is capitalization classed as punctuation?

Yes


What kind of noun is the word class?

The noun class is a singular, common, abstract noun; a word for
a group of students taught together; a group in society; a grouping
of things; a standard of service.
The word class is also a verb: class, classes, classing,
classed.

February 12, 2013 at 2:10 pm

#42681

Hey everyone,

I’ve got a feeling i’ve seen this done but i’m getting a complete mental block. I’m using the icomoon icon font and classes.

I am attaching various icons to different li in an ul. I am doing this using the class method so for example

<li class="icon-map">

what I want to do is select all versions of .icon without having to specify all of them. I’ve got a niggling feeling that i’ve seen this done but I might be imagining it or just quite simply forgot it.

Can anyone help??

Cheers.
Phil

February 12, 2013 at 2:48 pm

#124270

You can use an attribute selector where the attribute to be selected is class but must start with “icon” eg.

`[class^=”icon”] {

}`

This will select all elements with a class beginning with icon. If you want to learn more, this could help: https://css-tricks.com/attribute-selectors/

February 12, 2013 at 3:09 pm

#124275

February 12, 2013 at 4:21 pm

#124291

[class^="icon"] sadly fails if there is another class in specified before icon-whatever like &lt;li class="fancy icon-map"&gt;, go with [class*="icon"] as Paulie mentioned :)

February 12, 2013 at 4:24 pm

#124294

Right got it thank you everyone for your help.

I’m very glad that i didn’t just imagine it lol

May 20, 2016 at 8:08 am

#241921

FYI for those copy/pasting this in the future – replace the quotations! Mine failed initially because they were curly quotes.

November 9, 2016 at 10:40 pm

#247701

May 2, 2018 at 1:31 pm

#270503

How could you do this with Javascript?

May 2, 2018 at 9:52 pm

#270543

Look in to querySelectorAll() with the class/asterisk attribute selector advised above.

Понравилась статья? Поделить с друзьями:
  • Is a lot two words or one word
  • Is a lot all one word
  • Is a lexeme one word
  • Is a lacing word
  • Is a four letter word meaning