Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bertstem

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bertstem

BERT model fine-tuned on chilean STEM lessons

  • 0.0.33
  • PyPI
  • Socket score

Maintainers
1

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')

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc