Skip to content

Instantly share code, notes, and snippets.

View MaxGSEO's full-sized avatar

massimiliano geraci MaxGSEO

View GitHub Profile
@MaxGSEO
MaxGSEO / gist:4abfd0c257897528b3279636acfc3a5e
Created October 23, 2023 00:33
Testing Scoring System
from collections import Counter
import pandas as pd
# Define scoring variables
core_set_score = 5
second_tier_score = 3
third_tier_score = 1
grace_zone_boost = 1
entity_boost = 1
double_entity_boost = 2
@MaxGSEO
MaxGSEO / py
Created October 22, 2023 23:45
Python script that focuses solely on TF-IDF and n-gram extraction. It reads text from 10 files, performs the TF-IDF analysis, and then exports the results to an Excel sheet, including the n-gram, the files in which it appears, its count, and its frequency.
from sklearn.feature_extraction.text import TfidfVectorizer
from nltk.corpus import stopwords
from collections import Counter
import pandas as pd
import os
# Read text from files
texts = {}
for filename in os.listdir('./texts/'): # Assuming the files are in a folder called 'texts'
if filename.endswith('.txt'):
@MaxGSEO
MaxGSEO / gist:802d851c8701af7f3a73a1a57e2a9a57
Last active March 25, 2023 01:32
Script for adding a chatGPT formula in Google Sheet
// Constants
const API_KEY = "YOUR API KEY";
const MODEL_TYPE = "gpt-3.5-turbo"; //chatGPT model
const MAX_TOKENS = 4096;
function CHATGPT(promptCellRef, contentRangeRef) {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
// Get the prompt from the specified cell
const promptCell = sheet.getRange(promptCellRef);
@MaxGSEO
MaxGSEO / about-entities.json
Last active April 5, 2022 00:05
Schema markup about property - The Entities' Swissknive
<script type="application/ld+json">
[
{
"about": [
{
"@context": "http://schema.org",
"@type": "Thing",
"name": "Semantic publishing",
"description": "Semantic publishing on the Web, or semantic web publishing, refers to publishing information on the web as documents accompanied by semantic markup. Semantic publication provides a way for computers to understand the structure and even the meaning of the published information, making information search and data integration more efficient.",
"sameAs": [
@MaxGSEO
MaxGSEO / mentions-entities.json
Last active April 5, 2022 00:03
Schema markup mentions property - The entities' Swissknive
<script type="application/ld+json">
[
{
"mentions": [
{
"@context": "http://schema.org",
"@type": "Thing",
"name": "Named-entity recognition",
"description": "Named-entity recognition (NER) (also known as (named) entity identification entity chunking and entity extraction) is a subtask of information extraction that seeks to locate and classify named entities mentioned in unstructured text into pre-defined categories such as person names organizations locations medical codes time expressions quantities monetary values percentages etc. Most research on NER/NEE systems has been structured as taking an unannotated block of text such as this one: Jim bought 300 shares of Acme Corp",
"SameAs": [