Skip to main content

BERT-STEM

BERT model fine-tuned on Science Technology Engineering and Mathematics (STEM) lessons.

Install:

To install from pip:

pip install bertstem

Quickstart

To encode sentences :

from BERT_STEM.BertSTEM import *
bert = BertSTEM()

# Example dataframe with text in spanish
data = {'col_1': [3, 2, 1], 
'col_2': ['hola como estan', 'alumnos queridos', 'vamos a hablar de matematicas']}

df = pd.DataFrame.from_dict(data)

# Encode sentences using BertSTEM:
bert._encode_df(df, column='col_2', encoding='sum')

To classify sentences with COPUS models:

from BERT_STEM.BertSTEM import *

# Download BERT for classification (guiding/presenting/administration)
bert_classification = BertSTEMForTextClassification(2, model_name = 'pablouribe/bertstem-copus-guiding')

# Example dataframe with text in spanish
data = {'col_1': [3, 2, 1], 
'col_2': ['hola como estan', 'alumnos queridos', 'vamos a hablar de matematicas']}

df = pd.DataFrame.from_dict(data)

# Classify sentences using BertSTEM for COPUS (Guiding):
bert_classification.predict(df,'col_2')

To use it from HuggingFace:

from BERT_STEM.Encode import *
import pandas as pd
import transformers

# Download spanish BERTSTEM:
model = transformers.BertModel.from_pretrained("pablouribe/bertstem")

# Download spanish tokenizer:
tokenizer = transformers.BertTokenizerFast.from_pretrained("dccuchile/bert-base-spanish-wwm-uncased",
                                                            do_lower_case=True, 
                                                            add_special_tokens = False)

# Example dataframe with text in spanish
data = {'col_1': [3, 2, 1], 
        'col_2': ['hola como estan', 'alumnos queridos', 'vamos a hablar de matematicas']}
        
df = pd.DataFrame.from_dict(data)

# Encode sentences using BertSTEM:
sentence_encoder(df, model, tokenizer, column = 'col_2', encoding = 'sum')

Metadata

Release files for bertstem 0.0.33

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bertstem 0.0.33
File Size Uploaded Provenance Actions
bertstem-0.0.33.tar.gz 7.1 kB Without provenance Details for bertstem-0.0.33.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bertstem 0.0.33
File Interpreter ABI Platform Actions
bertstem-0.0.33-py3-none-any.whl Python 3 none any Details for bertstem-0.0.33-py3-none-any.whl

Total release size: 14.8 kB

Release files / bertstem-0.0.33.tar.gz

Download URL bertstem-0.0.33.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
aacc5159cd20d1f137ffd7553381268462001915cba9bf099713784995045f41
BLAKE2b-256 checksum
How to use checksums
e14485fa556d35d908304190dcf2fc5249f07f25d3d48570ce7fdf6529c29b36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.5

Release files / bertstem-0.0.33-py3-none-any.whl

Download URL bertstem-0.0.33-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98bf63d09ca126763da0d5a709b4cda1018173d2a25f2093b2ab9764a41483cf
BLAKE2b-256 checksum
How to use checksums
c6c12053cf4f5fff3f58debba32481ba262beac592e2997ef3aa28ee56c02faf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.5

Security for bertstem 0.0.33

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.33 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page