semvec/pypi-packages huggingface dataset:
nner 0.1.3
Nested Named Entity Recognition
Requires Python: >=3

# ***model name***

***xxx*** is our method used in [CBLUE](https://tianchi.aliyun.com/dataset/dataDetail?dataId=95414) (Chinese Biomedical Language Understanding Evaluation), a benchmark of Nested Named Entity Recognition. We got the 2nd price of the benchmark by 2021/12/06.



## Approach

**TODO:**

picture or paper



## Usage

First, install [PyTorch>=1.7.0](https://pytorch.org/get-started/locally/). There's no restriction on GPU or CUDA.

Then, install this repo as a Python package:

```bash
$ pip install nner
```



## API

The `nner` package provides the following methods:

`nner.load_NNER(model_save_path='./checkpoint/macbert-large_dict.pth', maxlen=512, c_size=9, id2c=_id2c)`

Returns the pretrained model. It will download the model as necessary. The model would use the first CUDA device if there's any, otherwise using CPU instead. 

The `model_save_path` argument specifies the path of the pretrained model weight.

The `maxlen` argument specifies the max length of input sentences. The sentences longer than `maxlen` would be cut off.

The `c_size` argument specifies the number of entity class. Here is `9` for CBLUE.

The `id2c` argument specifies the mapping between id and entity class. By default, the `id2c` argument for CBLUE is:

`_id2c = {0: 'dis', 1: 'sym', 2: 'pro', 3: 'equ', 4: 'dru', 5: 'ite', 6: 'bod', 7: 'dep', 8: 'mic'}`

------

The model returned by `nner.load_NNER()` supports the following methods:

`model.recognize(text: str, threshold=0)`

Given a sentence, returns a list of tuples with recognized entity, the format of the tuple is `[(start_index, end_index, entity_class), ...]`. The `threshold` argument specifies that the returned list only contains the recognized entity with confidence score higher than `threshold`.

`model.predict_to_file(in_file: str, out_file: str)`

Given input and output `.json` file path, the model would do inference according `in_file`, and the recognized entity would be saved in `out_file`. The output file can be submitted to [CBLUE](https://tianchi.aliyun.com/dataset/dataDetail?dataId=95414). The format of input file is like:

```json
[
  {
    "text": "..."
  },
  {
    "text": "..."
  },
  ...
]
```



## Examples

```Python
import nner

NNER = nner.load_NNER()
in_file = './CMeEE_test.json'
out_file = './CMeEE_test_answer.json'
NNER.predict_to_file(in_file, out_file)
```
post-type-discovery 1.0.0
Find the post type associated with a web page in accordance with the Post Type Discovery algorithm.
Requires Python: >=3.6

# IndieWeb Post Type Discovery

A library to discover the post type of a web page in accordance with the IndieWeb Post Type Discovery specification.

## Installation

To install this package, run the following command:

    pip install post-type-discovery

You can import the package using the following line of code:

    import post_type_discovery

## Usage

This library contains a `get_post_type` function that returns the post type of a linked web page.

This function uses the following syntax:

    get_post_type(url, custom_properties=[])

Here are the arguments you can use:

- `url`: The URL of the web page to discover the post type of.
- `custom_properties`: A list of custom properties to use when discovering the post type. This list must contain tuples.

The function returns a single string with the post type of the specified web page.

See the Post Type Discovery specification for a full list of post types.

### Custom Properties

The structure of the custom properties tuple is:

(attribute_to_look_for, value_to_return)

An example custom property value is:

    custom_properties = [
        ("poke-of", "poke")
    ]

This function would look for a poke-of attribute on a web page and return the "poke" value.

By default, this function contains all of the attributes in the Post Type Discovery mechanism.

Custom properties are added to the end of the post type discovery list, just before the "article" property. All specification property types will be checked before your custom attribute.

Here is an example of the `get_post_type` function in use:

    import indieauth_helpers

    url = "https://jamesg.blog/2021/12/06/advent-of-bloggers-6/"

    post_type = indieauth_helpers.discover_endpoint(url)

    print(post_type)

This code returns the following string:

    article

## License

This project is licensed under the [MIT license](LICENSE).

## Contributing

This project welcomes contributions from anyone who wants to improve the library.

Feel free to create an issue or pull request on GitHub and your contribution will be reviewed.

## Contributors

- capjamesg