• NLP: don’t rebuild the wheel


    By abhijit GuptaCompile VKSource: towards Data Science introduce Natural language processing (NLP) is a daunting field name. Generating useful conclusions from unstructured text is difficult, and there are numerous techniques and algorithms, each with its own use cases and complexity. As a developer with minimal exposure to NLP, it’s hard to know which methods to […]

  • Using shell to display wordcount function


       shell script programming is one of the most core technologies of Linux system. It can use simple commands to achieve some complex functions. At the same time, Linux provides many text processing commands, such as grep (grep family), TR, SED, awk, etc. once you master these commands, you can easily process text in Linux […]

  • transformer-xl


    Location coding Absolute position In vanilla transformerAbsolute position coding,$$\begin{equation}PE(pos,2i)=\sin(pos/10000^{\frac{2i}{d_{model}}})\tag{1}\end{equation}$$$$\begin{equation}PE(pos,2i+1)=\cos(pos/10000^{\frac{2i}{d_{model}}})\tag{2}\end{equation}$$ def positional_embedding(pos_seq, inv_freq, bsz=None): sinusoid_inp = tf.einsum(‘i,j->ij’, pos_seq, inv_freq) pos_emb = tf.concat([tf.sin(sinusoid_inp), tf.cos(sinusoid_inp)], -1) if bsz is not None: return tf.tile(pos_emb[:, None, :], [1, bsz, 1]) else: return pos_emb[:, None, :] pos_ Seq and inv_ Freq are pos_seq = tf.range(klen – 1, -1, -1.0) inv_freq = […]

  • leetcode 151. Reverse Words in a String


    Title Requirements Given an input string, reverse the string word by word. For example, Given s = “the sky is blue”, return “blue is sky the”. Update (2015-02-12): For C programmers: Try to solve it in-place in O(1) space. click to show clarification. Clarification: What constitutes a word? A sequence of non-space characters constitutes a […]

  • Regular expressions in Linux


    importance Through sed or awk tools, we can easily and happily analyze a pile of text, process data, analyze server error logs, and analyze server user access logs. But in order to play well with sed and awk tools, regular expressions are the foundation, so we have to master them. Single character Specific characters Such […]

  • Dictionary tree of data structure (prefix tree, trie)


    1、 Introduction The dictionary tree is specially designed for string processing. The time complexity of each entry is independent of the total number of entries in the field, and is related to the length of the query string. 1. What is a dictionary tree Dictionary tree structure Note: the above figure shows a dictionary tree […]

  • How to use grep command to find multiple strings


    How to use grep command to find multiple strings Hello everyone, I’m Liang Xu! Today I’d like to introduce you to a very useful technique, which is to usegrepCommand to find multiple strings. For a brief introduction,grepCommand can be understood as a powerful command-line tool, which can be used to search for text matching regular […]

  • VIM advanced – move and jump


    I believe you already knowhjklIf you don’t know what it means,Look here。 hjklIt can also be faster! Here I (without any inclination) assume that you are using a MacBook, open itSystem Preferences > keyboardTo set the “key repeat” and “delay before repeat” to the fastest. “Key repetition” determines how fast the system will input a […]

  • Real time computing framework: Spark cluster construction and introduction case


    1、 Spark overview 1. Introduction to spark Spark is designed for large-scale data processing. It is a fast, universal and scalable cluster computing engine based on memory. It implements an efficient DAG execution engine. It can process data streams efficiently based on memory. Compared with MapReduce, the computing speed has been significantly improved. 2. Operation […]

  • Top 100 PHP functions


    1、 Background In the past two days, I tried to memorize words, thinking that I should write down the most frequently used words first. After finding several articles on the Internet, I analyzed a number of words, and the effect was pretty good; Then I thought of the code, and I was curious about the […]

  • [regular expression] basic reference book about boundary


    Write before: all the following metacharacters match not the actual character, but a “virtual” position. 1. Overall boundary 1. Matching the starting position^ ^Written after the first square bracket in the character set to indicate “not”.^If it is written at the front of the whole regular expression, it indicates the starting position of the matching […]

  • Crawler boss, gave me the regular expression he summarized!


    Author: Xiao Fu GeBlog:https://bugstack.cn Precipitation, sharing, growth, so that they and others can gain! 1、 Preface Programming always produces results in practice! Regular expression, also known as regular expression. Regular expression, often abbreviated as regex, regexp or re in code, is a concept of computer science. Regular expressions are usually used to retrieve and replace […]