Question: Does anyone know how to define the matcher pattern of "NNP/NN NNP/NN" in SpaCy, which means the desirable matches is "NNP NNP", "NNP NN", "NN NNP", or "NN NN"? Thank you!

Answer: 
Use the `IN` operator, which checks for the value in a list:

```py
tag_nn_nnp = {"TAG": {"IN": ["NN", "NNP"]}}
pattern = [tag_nn_nnp, tag_nn_nnp]
matcher.add("NN_NNP_2", [pattern])

```

See: <https://spacy.io/usage/rule-based-matching#adding-patterns-attributes-extended>
There isn't an `or` logical operator, but in your specific case you can simulate with either a list of rules, or with a regex rule:

List of rules:
--------------

```
patterns = [
   [{'TAG': 'NNP'}, {'TAG': 'NN'}],
   [{'TAG': 'NN'}, {'TAG': 'NNP'}],
   # add more if required
]

```

and then add all patterns to the matcher. See [this example](https://explosion.ai/demos/matcher?text=France%20president%20&model=en_core_web_sm&pattern=%5B%7B%22id%22%3A3%2C%22attrs%22%3A%5B%7B%22name%22%3A%22TAG%22%2C%22value%22%3A%22NNP%22%7D%5D%7D%2C%7B%22id%22%3A1%2C%22attrs%22%3A%5B%7B%22name%22%3A%22TAG%22%2C%22value%22%3A%22NN%22%7D%5D%7D%5D)

Regex
-----

Works only on modern spacy version, but I admit I haven't tested this):

```
pattern = [{"POS": {"REGEX": "^NNP?$"}}, {"POS": {"REGEX": "^NNP?$"}}]

```

Notes
-----

The "POS" attribute refers to the universal PoS tag set, which labels nouns as PROPN or NOUN. For English, you can use "TAG", which will give you the PTB tag set (NN, NNP, etc) but it really depends what you are after