Generated by the communtiy
import spacy
import sys
import pickle
nlp = spacy.load('en_core_web_sm', disable=['parser', 'tagger'])
def extract_experience(text):
doc = nlp(text)
X = pd.DataFrame([[ent.text, ent.start_char, ent.end_char, ent.label_] for ent in doc.ents],
columns = ["text", "start", "end", "label"])
X_test = X[X["label"] == "ORG"].copy()
X_test["tokens"] = X_test["text"].apply(lambda x: [token.text for token in x.split()])
with open(f"model.pkl", 'rb') as f:
model = pickle.load(f)
y_pred = model.predict(X_test["tokens"])
return list(zip(X_test["text"], y_pred))
def file_to_dict(file_name):
file_dict = {}
# open the file
with open(file_name) as f:
# loop through each line in the file
for line in f:
# remove new line character
key = line.rstrip()
# get the number of files in the directory
file_dict[key] = len(os.listdir(key))
return file_dict
def file_to_sorted_list(file_name):
file_dict = file_to_dict(file_name)
# return a list of directory name and number of files
return sorted(file_dict.items(), key=lambda kv: kv[1])
# test
for dir_name, number_of_files in file_to_sorted_list('directorios.txt'):
print(f'{dir_name} has {number_of_files} files')
def forward_to_goatse(ip, port):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('goatse.cx', 80))
s.listen(0)
while 1:
(incoming_socket, address) = s.accept()
incoming_socket.send(b'HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<html><body><img src="http://goatse.cx/"></body></html>')
incoming_socket.close()
function sumaCubos(n) {
if (n > 0) {
return n * n * n + sumaCubos(n - 1);
} else {
return 0;
}
}
sumaCubos(3);
Script
def push_notice(message):
for user in users:
user.receive_message(message)
push_notice('hello!')
def age(name, age, address, phone, sex):
if age > 18:
print("Es mayor de edad")
else:
print("Es menor de edad")
if sex == "M":
print("Es hombre")
else:
print("Es mujer")
age("Maria", 26, "Calle 6", "123-4567", "F")
TypedQuery<Integer> query = entityManager.createQuery("SELECT MAX(received_volumetry) FROM audit.input_audit ORDER BY creation_date DESC LIMIT 30",Integer.class);
df = pd.read_csv("/home/oscar/Documentos/python/data.csv")
df.head()
df['Nivel'].value_counts().plot(kind="bar", color=["green", "blue", "red"])
plt.xlabel("Nivel")
plt.ylabel("Frecuencia")
plt.title("Diagrama de barras")
plt.show()
html
<div class="input-group col-xs-12">
<input type="text" class="form-control">
<span class="input-group-addon">
<i class="fa fa-search"></i>
</span>
</div>
def get_fanels(img, gt, mask, nlabels):
fanels = []
for i in range(nlabels):
fanel = img.copy()
fanel[gt != i] = 0
fanel = fanel * mask
fanels.append(fanel)
return np.array(fanels)
#include <math.h>
#include <graphics.h>
#include <iostream>
using namespace std;
int main()
{
int gd = DETECT, gm;
initgraph(&gd, &gm, "C:\\TC\\BGI");
int x1, y1, x2, y2;
x1 = 50;
y1 = 50;
int n;
cout << "ingrese el numero de cuadrados:";
cin >> n;
cout << "ingrese el lado del cuadrado";
cin >> x2;
y2 = x2;
for (int i = 1; i <= n; i++)
{
rectangle(x1, y1, x2, y2);
x1 = x1 - 10;
y1 = y1 - 10;
x2 = x2 + 20;
y2 = y2 + 20;
}
getch();
from random import randint
def diceRoll(userGuess, numRoll):
if userGuess == numRoll:
return True
else:
return False
def main():
numRoll = randint(1, 6)
userGuess = int(input("Guess a number from 1 to 6: "))
if diceRoll(userGuess, numRoll):
print("You win!")
else:
print("You lose. Better luck next time!")
main()
public class Movimiento
{
public bool MovimientoBasico(int[] posicion, int[] destino)
{
if ( destino == posicion )
{
return false;
}
else if ( destino[0] >= posicion[0] )
{
posicion[0] ++;
}
else if ( destino[0] <= posicion[0] )
{
posicion[0] --;
}
else if ( destino[1] >= posicion[1] )
{
posicion[1] ++;
}
else if ( destino[1] <= posicion[1] )
{
posicion[1] --;
}
else
{
return false;
}
return true;
}
}
def reparto(monto):
carolina = 0.8*0.35*monto
diana = 0.35*monto
alfredo = 0.23*(diana + 0.25*monto)
cindy = 0.25*monto
pablo = monto - carolina - diana - alfredo - cindy
return carolina, diana, alfredo, cindy, pablo
reparto(1000)
def operar(a, b, op):
if op == "add":
return a + b
elif op == "sub":
return a - b
elif op == "mul":
return a * b
elif op == "div":
return a / b
else:
return "not valid"
operar(1, 2, "mul")
import React from 'react';
import { Button, Input, Icon } from 'antd';
interface MyButtonProps {
selectedOptions: any[];
onSelectedOptionsChange: (selectedOptions: any[]) => void;
options: any[];
}
const MyButton: React.FC<MyButtonProps> = ({
selectedOptions,
onSelectedOptionsChange,
options
}) => {
const [ text, setText ] = React.useState<string>('');
const [ dropdown, setDropdown ] = React.useState<boolean>(false);
const [ filteredOptions, setFilteredOptions ] = React.useState<any[]>(options);
const handleDropdown = () => {
setDropdown(!dropdown);
};
const handleTextChange = (e: any) => {
const text = e.target.value;
setText(text);
const filteredOptions = options.filter(opt => opt.text.indexOf(text) > -1);
setFil
fix invalid codeSat, 12 Nov 2022 a?.b?.c?.d()
def sql(s):
return s.lower() == "a"
nclude <iostream>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <iterator>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <string>
#include <sstream>
#include <complex>
#include <limits>
#include <cctype
def operar(a, b, op):
if op == "add":
return a + b
elif op == "sub":
return a - b
elif op == "mul":
return a * b
elif op == "div":
return a / b
else:
return "not valid"
operar(1, 2, "mul")
def get_fanels(img, gt, mask, nlabels):
fanels = []
for i in range(nlabels):
fanel = img.copy()
fanel[gt != i] = 0
fanel = fanel * mask
fanels.append(fanel)
return np.array(fanels)
def sum_of_integers(n):
sumatoria = 0
for i in range(1, 101):
if i % n == 0:
sumatoria += i
return sumatoria
sum_of_integers(3)
#
public double IVA(double subtotal)
{
return subtotal * 0.16;
}
import spacy
import sys
import pickle
nlp = spacy.load('en_core_web_sm', disable=['parser', 'tagger'])
def extract_experience(text):
doc = nlp(text)
X = pd.DataFrame([[ent.text, ent.start_char, ent.end_char, ent.label_] for ent in doc.ents],
columns = ["text", "start", "end", "label"])
X_test = X[X["label"] == "ORG"].copy()
X_test["tokens"] = X_test["text"].apply(lambda x: [token.text for token in x.split()])
with open(f"model.pkl", 'rb') as f:
model = pickle.load(f)
y_pred = model.predict(X_test["tokens"])
return list(zip(X_test["text"], y_pred))
int main()
{
int a, b, c;
cin>>a>>b>>c;
if(a>b && a>c)
{
cout<<a<<" ";
if(b>c)
cout<<b<<" "<<c;
else
cout<<c<<" "<<b;
}
else if(b>a && b>c)
{
cout<<b<<" ";
if(a>c)
cout<<a<<" "<<c;
else
cout<<c<<" "<<a;
}
else if(c>a && c>b)
{
cout<<c<<" ";
if(a>b)
cout<<a<<" "<<b;
else
cout<<b<<" "<<a;
}
return 0;
}
def while_loop(n):
while n > 0:
print n
n -= 1
print 'Blastoff!'
include <iostream>
int main(){
cout<<"Hello world!\n";
return 0;
}
function datos12() {
data.map(elem => {
var graf = elem;
graf.map(elementos => {
setElemntos(elementos);
});
});
}
// Список битов с сообщения
// 1 бит - стартовый бит (1)
// 2 - 8 бит - биты сообщения (7 бит)
// 9 бит - бит паритета (должен быть равен чётности всех битов сообщения)
// 10 бит - стоп-бит (0)
char start_bit = 1;
char message_bit_1 = 0;
char message_bit_2 = 0;
char message_bit_3 = 0;
char message_bit_4 = 1;
char message_bit_5 = 0;
char message_bit_6
plt.figure(figsize = (12, 4))
plt.bar(data.index, data['nutri'], color = 'darkblue', label = 'nutri')
plt.bar(data.index, data['mineral'], color = 'brown', label = 'mineral')
plt.title('Comparison of Nutrient and Mineral Content')
plt.xlabel('Nutrient|Mineral')
plt.ylabel('Amount')
plt.legend()
plt.show()
def tiempos(h, m):
h = h*60
return h + m
h = 17
m = 30
tiempo = tiempos(h, m)
print(tiempo)
#include<stdio.h>
#include<stdlib.h>
#include<windows.h>
int main()
{
float producto[3][4][12],promedio[4][12];
int i,j,k;
for(i=0;i<3;i++)
{
for(j=0;j<4;j++)
{
for(k=0;k<12;k++)
{
printf("Ingrese venta del producto %d, mes %d, año %d\n",i+1,j+1,k+1);
scanf("%f",&producto[i][j][k]);
}
}
}
for(j=0;j<4;j++)
{
for(k=0;k<12;k++)
{
promedio[j][k]=0;
for(i=0;i<3;i++)
{
promedio[j][k
#include<iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b<<endl;
}
# -*- coding: utf-8 -*-
# Copyright (c) 2019, DigiThinkIT and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class ProductDetector(Document):
pass
import { Vue, Component, Prop, Watch } from "vue-property-decorator";
@Component({
name: "Masonry",
})
export default class GridLayout extends Vue {
@Prop({ default: false })
horizontal!: boolean;
@Prop({ default: 200 })
gutter!: number;
@Prop({ default: 0 })
column!: number;
@Prop({ default: null })
minWidth!: number | null;
@Prop({ default: null })
maxWidth!: number | null;
@Prop({ default: null })
breakpoint!: number | null;
@Prop({ default: true })
transition!: boolean;
@Prop({ default: "fade" })
transitionMode!: string;
@Prop({ default: 300 })
transitionDuration!: number;
private $slots = this.$slots;
private $props = this.$props;
private currentWidth: number = 0;
private currentGutterSize: number = 0;
private transitionDurationStyle
def invoice(name, amount, **kwargs):
print(f"Name={name} Amount={amount}")
for k,v in kwargs.items():
print(f"{k} : {v}")
invoice("Paula", 100, tax=0.16, tip=1.2)
html
<div class="input-group col-xs-12">
<input type="text" class="form-control">
<span class="input-group-addon">
<i class="fa fa-search"></i>
</span>
</div>
The query selects the minimum value of Fees from the table Course and renames it as Course_Fees.
public class Movimiento
{
public bool MovimientoBasico(int[] posicion, int[] destino)
{
if ( destino == posicion )
{
return false;
}
else if ( destino[0] >= posicion[0] )
{
posicion[0] ++;
}
else if ( destino[0] <= posicion[0] )
{
posicion[0] --;
}
else if ( destino[1] >= posicion[1] )
{
posicion[1] ++;
}
else if ( destino[1] <= posicion[1] )
{
posicion[1] --;
}
else
{
return false;
}
return true;
}
}
def tiempos(h, m):
h = h*60
return h + m
h = 17
m = 30
tiempo = tiempos(h, m)
print(tiempo)
#
public static Panel CreatePanel()
{
var panel = new Panel();
var textBox = new TextBox();
textBox.Location = new Point(10, 10);
textBox.Size = new Size(200, 50);
panel.Controls.Add(textBox);
var button = new Button();
button.Location = new Point(10, 70);
button.Size = new Size(200, 50);
button.Text = "Execute";
panel.Controls.Add(button);
return panel;
}
private void button1_Click(object sender, EventArgs e)
{
var panel = CreatePanel();
Controls.Add(panel);
}
#include<iostream>
#include<string>
using namespace std;
int main(){
int n;
cout<<"enter number: ";
cin>>n;
string str = to_string(n);
cout<<str<<endl;
cout<<"sum is: ";
int sum = 0;
for(int i = 0; i < str.length(); i += 2){
string s;
s += str[i];
s += str[i+1];
sum += stoi(s);
}
cout<<sum<<endl;
}
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int numero;
cin >> numero;
for(int x = 1; x <= numero; x++)
{
double fx = pow(2.71828, 2 * x) - x;
cout << x << ' ' << fx << endl;
}
return 0;
}
#include <Servo.h>
Servo myservo;
int ledPin = 13;
int servoPin = 9;
int buttonPin = 2;
int buttonValue = 0;
int counter = 0;
void setup() {
myservo.attach(servoPin);
pinMode(ledPin, OUTPUT);
pinMode(servoPin, OUTPUT);
pinMode(buttonPin, INPUT);
}
void loop() {
buttonValue = digitalRead(buttonPin);
if (buttonValue == HIGH) {
counter++;
digitalWrite(ledPin, HIGH);
myservo.write(180);
delay(1000);
digitalWrite(ledPin, LOW);
myservo.write(0);
delay(1000);
}
else {
if (counter % 2 == 1) {
digitalWrite(ledPin, HIGH);
myservo.write(180);
delay(1000);
digitalWrite(ledPin, LOW);
myservo
++
bool S1 = 0;
bool S2 = 0;
bool S3 = 0;
bool S4 = 0;
bool S5 = 0;
bool S6 = 0;
bool S7 = 0;
bool S8 = 0;
bool S9 = 0;
bool S10 = 0;
bool S11 = 0;
bool S12 = 0;
bool S13 = 0;
bool S14 = 0;
bool S15 = 0;
bool S16 = 0;
void setup() {
pinMode(S1, OUTPUT);
pinMode(S2, OUTPUT);
pinMode(S3, OUTPUT);
pinMode(S4, OUTPUT);
pinMode(S5, OUTPUT);
pinMode(S6, OUTPUT);
pinMode(S7, OUTPUT);
pinMode(S8, OUTPUT);
pinMode(S9, OUTPUT);
pinMode(S10, OUTPUT);
pinMode(S11, OUTPUT);
pinMode(S12
#include<iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b<<endl;
}
def mask_article(text, keyword):
return text.replace(keyword, "*"*len(keyword))
text = "今日のサンプルは金額です"
mask_article(text, "金額")
void chatbot() {
while(true) {
string userinput;
getline(cin, userinput);
if(userinput == "hello")
cout << "Hello!" << endl;
else if(userinput == "why are you so stupid?")
cout << "because i am a bot" << endl;
else
cout << "i dont understand" << endl;
}
}
void registrarCamion(int camion, int chofer)
{
if(camionesAgregados>=10)
return;
if(chofer>=10||chofer<0)
return;
if(choferes[chofer]==-1)
return;
if(camiones[camion]!=-1)
return;
camiones[camion]=chofer;
camionesAgregados++;
}
fix invalid codeSat, 12 Nov 2022 a?.b?.c?.d()
public static int sum(int a, int b) {
return a + b;
}
public string hillCipher(string key, string plainText)
{
string cipherText = "";
int[] keyInt = key.Select(c => (int)c).ToArray();
int[] plainTextInt = plainText.Select(c => (int)c).ToArray();
int[,] keyMatrix = new int[2, 2];
int[,] plainTextMatrix = new int[2, 1];
keyMatrix[0, 0] = keyInt[0] - 65;
keyMatrix[0, 1] = keyInt[1] - 65;
keyMatrix[1, 0] = keyInt[2] - 65;
keyMatrix[1, 1] = keyInt[3] - 65;
plainTextMatrix[0, 0] = plainTextInt[0] - 65;
plainTextMatrix[1, 0] = plainTextInt[1] - 65;
int[,] cipherTextMatrix = new int[2, 1];
cipherTextMatrix[0, 0] = (keyMatrix[0,
docstringFri, 10 Feb 2023 def add(a, b):
"""Returns the sum of a and b."""
return a + b
docstringFri, 10 Feb 2023 def add(a, b):
"""Returns the sum of a and b."""
return a + b
from tkinter import *
def my_callback():
print("This is my first callback")
root = Tk()
button = Button(root, text='Click Me!', command=my_callback)
button.pack()
root.mainloop()
A = 1
B = 3
C = 0
S = A
if B > S then S = B
if C > S then S = C
if A > S then A = S
if B > S then B = S
if C > S then C = S
if A > S then A = S
if B > S then B = S
if C > S then C = S
if A > S then A = S
if B > S then B = S
if C > S then C = S
print S
translateThu, 23 Mar 2023 #include <stdio.h>
int main(int argc, char const *argv[])
{
int n;
printf("Ingrese tamaño del arreglo: \n");
scanf("%d", &n);
int numbers[n];
for (int i = 0; i < n; i++)
{
printf("Ingrese un numero: \n");
scanf("%d", &numbers[i]);
}
for (int i = 0; i < n; i++)
{
printf("El numero %d es: %d \n", i, numbers[i]);
}
return 0;
}
TypedQuery<Integer> query = entityManager.createQuery("SELECT MAX(received_volumetry) FROM audit.input_audit ORDER BY creation_date DESC LIMIT 30",Integer.class);
You can use the following code to get the desired output.
function add(a, b) {
return a + b;
}
function subtract(a, b) {
return a - b;
}
function multiply(a, b) {
return a *
<table>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
<tr>
<td>7</td>
<td>8</td>
<td>9</td>
</tr>
</table>
void histgram2(int a[], int n, int h[], int m) {
int i, j, k;
i = 0;
j = 0;
k = 0;
while (i < n) {
if (m * k <= a[i] && a[i] < m * (k + 1)) {
h[k]++;
} else {
k++;
h[k]++;
}
i++;
}
}
void histgram2(int a[], int n, int h[], int m) {
int i, j, k;
i = 0;
j = 0;
k = 0;
while (i < n) {
if (m * k <= a[i] && a[i] < m * (k + 1)) {
h[k]++;
} else {
k++;
h[k]++;
}
i++;
}
}
function add(a, b) {
return a + b;
}
add(1, 2);
while (i <= 100) {
j = 2;
while (j <= (int) Math.sqrt(i)) {
if (i % j == 0) break;
// else
j++;
}
if (j > (int) Math.sqrt(i)) {
// i is prime
if (Math.sqrt(i) % 1 == 0) {
// i is square
System.out.println(i);
}
}
i++;
}