This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import tensorflow as tf | |
def add_values(num_list): | |
# making a list of tensors. | |
tensor_list = tf.constant(num_list, shape=[1, 3], name='tensor_list') | |
tensor_ten = tf.constant([10] * len(num_list), \ | |
shape=[len(num_list), 1], name='tensor_ten') | |
# the below statement declares a scope under which the | |
# variables will be used. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import tensorflow as tf | |
from random import shuffle | |
class Glove: | |
"""docstring for Glove""" | |
def __init__(self, corpus, context_size=2, learning_rate=0.05, batch_size=100, num_epochs=100): | |
super(Glove, self).__init__() | |
self.corpus = corpus | |
self.CONTEXT_SIZE = context_size |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*************** Kmp Functions. ***************/ | |
void compute(int * kmparr, char * pattern, int patternlength) { | |
int m = patternlength; | |
kmparr[0] = 0; | |
int len = 0, i; | |
for (i = 1; i < m; ++i) | |
{ | |
if (pattern[i] == pattern[len]) | |
{ |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vector<int> Knuth_Morris_Pratt(string text,string pattern) | |
{ | |
vector<int> F = build_failure_function(pattern); | |
vector<int> positions; | |
int i = 0; // state of automaton | |
int j = 0; // position of counter in string. | |
for( ; ; ) { | |
if(j == n) break; // we reached the end of the text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int strsize; | |
char str[10000]; | |
void input() | |
{ | |
strsize = 1; | |
char c = getchar(); | |
while(('a' > c) || (c > 'z')) | |
c = getchar(); | |
str[0] = c; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Single Element | |
// --- | |
var Nav; | |
// Define Nav as tag, component, anything. | |
// Input (JSX): To be written by you. | |
var app = <Nav color="blue"/>; | |
// Output (JS): Compiled and converted to this by Babel. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Input (JSX): | |
var content = <Container>{window.isLoggedIn ? <Nav /> : <Login />}</Container>; | |
// Output (JS): | |
var content = React.createElement( | |
Container, | |
null, | |
window.isLoggedIn ? React.createElement(Nav) : React.createElement(Login) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var props = {}; | |
props.foo = x; | |
props.bar = y; | |
// Write your attribute with the props defined. | |
var component = <Component {...props} />; | |
//-- | |
// If needs to be changed later, this could be done. |