{'fraction_non_alphanumeric': 0.04417119321912493, 'fraction_numerical': 0.01432579239539187, 'mean_word_length': 4.017669961066187, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 11, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Towards p-Adic Artificial Language

Motivated by successful p-adic modeling of the genetic code, in this paper a p-adic (ultrametric) language is introduced. This language can serve as an effective and advanced constructive element of a future artificial intelligence. In this geometric approach to artificial language, we mainly use p-adic distance as the most powerful example of ultrametrics. Here p-adic distance is a tool to quantify similarity between words – similarity between their structure and similarity between their meaning. As a simple illustration, a p-adic language with four letters and their 3-letter words is presented.


Introduction
Language, as finite ordered sequences (words) of some finite set of elements (letters) with relevant rules, is an important component of all living organisms -from single cells to the humans. There are different forms of languages that have emerged during evolution.
The oldest language is related to the genetic code. Namely, the genetic code can be viewed as a language, which letters are four nucleotides (C, A, U, G) and words are codons as ordered triples of nucleotides. Meaning of 64 codons are 20 canonical amino acids plus one stop signal. Consequently, meaning of genes are proteins. This genetic language emerged at the very beginning of life on our planet and exists so far in almost the same form without changes. It is an invariant of life evolution, because all other constituents of living organisms have experienced changes.
In a series of papers [1][2][3][4][5][6] (see also [7]) was shown that set of 64 codons can be presented as an ultrametric tree and that the degeneracy of the vertebrate mitochondrial (VM) code can be adequately described by p-adic distance. The VM code is very simple and other dozen genetic codes can be considered as its slight variations.
Note that p-adic distance is the most elaborated and useful example of ultrametrics. By appropriate identification of nucleotides and digits in 5-adic representation of 64 codons, one obtains 32 codon doublets which code amino acids or stop signal. Codons in these doublets are at the smallest 5-adic and 2-adic distance. One can say that two codons coding the same amino acid or stop signal have the same meaning, because they are p-adically (ultrametrically) closest each other with respect to all other codons. For such codons we also say that they are, in the information sense, similar.
The p-adic (ultrametric) approach to closeness between codons was extended to canonical amino acids, and also between codons and amino acids, see e.g. [5]. In this way, the genetic code can be regarded as an ultrametric network.
It is worth noting that doublets of vertebrate mitochondrial codons, which code the same amino acid or stop signal, have the same first two nucleotides. In fact, two sequences of letters are more close if they have more same elements at places counting from the beginning. This is a general property of any ultrametric space of sequences. In human languages, which are based on letters, there are also some ultrametricity, but not so strict as in the case of codons.
In this paper, we propose an ultrametric (p-adic) language for a future artificial intelligence. In biology there is an approximative rule between physico-chemical structure and biological function: similar in structure -similar in function. Our goal is to have an artificial language with strong connection between structure and meaning: similar in structure -similar in meaning. Such language with ultrametric similarity, should be simple, economic and effective. Namely, our intention is to have language in which notions with similar meaning are expressed by words of similar structure. Therefore, we consider an ultrametric approach which is motivated by language of the genetic code.

Ultrametric (p-Adic) Space of Sequences
Ultrametric space is a set U with a real-valued function d of any two elements on U satisfying the following properties: Property (iii) is called strong triangle inequality. Note that usual distance must satisfy triangle inequality, i.e.
d(x, y) ≤ d(x, z) + d(z, y). ( As a consequence of property (iii), all ultrametric spaces have some unusual properties, like: • in all triangles two sides are equal and the third one is smaller or equal to others, • there is no partial intersection of the balls, • any point of a ball can be its center.
There are many examples of ultrametric spaces. In the sequel we shall consider ultrametric space of sequences. Let S be a set of sequences of the same finite length n. The set S can be a finite ultrametric space by defining an appropriate distance.
An ordinary ultrametric distance between any two elements x and y of S can be introduced in the following way: d(x, y) = n − m, where m is a number of the first equal elements counting from the beginning in both sequences x and y. Thus 0 ≤ m ≤ n and 0 ≤ d(x, y) ≤ n. It is evident that properties (i) and (ii) are satisfied. Property (iii) can be shown by analyzing possible distances between three arbitrary sequences x, y and z. It is worth noting that this ordinary ultrametric distance can be redefined by scaling it as d s (x, y) = n−m n and then it takes values 0 ≤ d s (x, y) ≤ 1.
Another example of ultrametric space of sequences is related to the Baire distance. This distance is defined as d B (x, y) = 2 −m , where m is the same as in the previous case, i.e. it is a number of the first positions at which sequences x and y have the same elements. Here the base 2 can be replaced by any other natural number greater than 2. In the definition of the Baire distance is not necessary that sequences are finite and equal in length.

p-Adic distance
The most significant example of ultrametrics is p-adic distance. Consider now finite sequences of the fixed length n in the form where x i = 0, 1, ..., p − 1 (are integers between 0 and p − 1) and p is a prime number. Then these sequences can be viewed as numbers in the base p in the following way: where x i are related digits. By definition, p-adic distance between x = x 0 x 1 x 2 ... x n and y = y 0 y 1 y 2 ... y n is where m is now number of equal first digits in both x and y. In other words, if difference between two integers x and y is divisible by p m , then p-adic distance between them is p −m . Thus, one can say: more divisibility = smaller distance = more similarity. p-Adic distance can be applied to some ultrametric sequences only when it is possible to transform them to numbers in a base p, where p is a prime number. Numbers endowed with p-adic distance are called p-adic numbers. In the last 30 years p-adic numbers, and related p-adic analysis, have had many applications in construction of new models in physics and biology (for a recent review, see [8]). In particular, p-adic models play are appropriate for description of complex systems with hierarchical structure.

On real and p-adic numbers
It is worth noting some differences between real and p-adic numbers. To see it in a simple way, it is sufficient to consider only natural numbers. Any natural number n has a unique expansion with respect to a given prime number p, i.e. n = n 0 + n 1 p + n 2 p 2 + ... + n k p k , where n i = 0, 1, 2, ..., p − 1 (i = 0, 1, 2, ..., k) are digits. There are two kinds of absolute value (norm) for this natural number: • ordinary absolute value, usually denoted by | · | , • p-adic absolute value (p-adic norm), denoted by | · | p .
Ordinary absolute value of this number is just usual sum of its terms, i.e. |n| = n. However, in the case of p-adic absolute value, situation is quite different and in a sense inverse. Namely, by definition, p-adic absolute value of n, presented as n = m p k with respect to a given p and m is not divisible by p, is Hence, p-adic absolute value of n in (6) is equal to the highest p-adic value of its terms. p-Adic absolute value is a very important example of non-Archimedean (ultrametric) norm and satisfies the following properties: where here x, y, z are some natural (rational) numbers. This p-adic norm can be easily extended to integer and also rational numbers. From algebraic point of view, set of rational numbers Q is a simple infinite number field. All numerical results of measurements are some rational numbers. According to the Ostrowski theorem, any nontrivial norm on the field Q is equivalent either to ordinary absolute value or to p-adic absolute value, where p is a prime number. As the field R of real numbers can be obtained by completion of Q with respect to distance induced by the ordinary absolute value, so the p-adic number field Q p is completion by the same procedure where instead of ordinary absolute value is used p-adic norm, see e.g. [9]. There is p-adic analysis, which has been employed in construction of some physical models since 1987 and is named p-adic mathematical physics (for a recent review, see [8]). p-Adic modeling in physics was extended to bioinformation, and p-adic model of the genetic code [1][2][3][4][5][6] is an evident successful example.
Using positional notation, we present number (6) differently in real and p-adic case: n = n k n k−1 ... n 1 n 0real number, and n = n 0 n 1 ... n k−1 n k -p-adic number. By this presentation, in both cases we see that values of terms decrease from the left to the right of digit sequences.
Real and p-adic distance are related to their absolute values respectively as follows: d(x, y) = |x − y| , d p (x, y) = |x − y| p , where x and y are some natural (rational) numbers.

Ultrametric (p-Adic) Language
We want to construct now an ultrametric language in the following way. Let we have m letters of an alphabet and let k be a fixed length of the corresponding words. Then n = m k is a total number of words in this language. Let these n words denote some n things (objects). Can we, in principle, assign a number of properties to each of these things (words) and to be able to describe them? The answer is positive and is related to the p-adic absolute value. As it is well known, there are infinitely many prime numbers. To a natural number we can apply any p-adic norm, which is less or equal to 1. For a fixed p, let its p-adic norm is related to a definite characteristic, which we can call p-adic property. For different primes we will have different p-adic properties. Using p-adic distance between words we can investigate similarity of p-adic properties between these words. To illustrate this subject, let us consider an example where number of letters m = 4 and length of words k = 3. There are 64 words for 64 objects: A 1 , A 2 , A 3 , ..., A 63 , A 64 . Let these 64 words (objects) be presented in base 5 as follows: where x i = 1, 2, 3, 4. Note that 5-adic norm of any 64 numbers of the form x in (9) is |x| 5 = 1, because the first digit x 0 0. But 5-adic distance between two different numbers a = a 0 + a 1 5 + a 2 5 2 and b = b 0 + b 1 5 + b 2 5 2 may have one of the following three values: At Table 1 we presented 64 numbers in base 5 as a numerical representation of 64 words, which denote some objects A 1 , A 2 , A 3 , ..., A 63 , A 64 . With respect to 5-adic distance, for each object A i there are 48 other objects at distance equal 1, also 12 objects at distance 1 5 , and 3 objects at distance 1 25 . For example, object A 1 presented by number 111 is at 5-adic distance equal 1 with respect to all other numbers which first digit is 2, 3 or 4.
Note that in p-adic model of the genetic code (vertebrate mitochondrial code), Table 1 is used for modeling 5-adic and 2-adic similarity between codons to find rule according to which two codons code the same amino acid (for details see, e.g. [5]).
At Table 2 all 64 numbers, from Table 1, are presented as product of their primes written in the decimal notation. Thus, for each number we use here two bases: on the left hand side of equality is base 5 and on the right hand side notation of primes is in base 10. One can see presence of all primes between 2 and 61 except 5, as a consequence of given representation in base 5. This presentation by product of related primes gives us possibility to find easily p-adic norms according to definition (7) for all 64 natural numbers. When there is not explicitly a prime number in the factorization of presented numbers, it can be regarded that such prime number is present like p 0 = 1 and the corresponding p-adic norm is 1. So all 64 numbers with respect to primes p > 61 have p-adic norm equal to 1.
It is also important to know p-adic distances between any two numbers in Table 1. As a consequence of representation in base 5 with digits 1, 2, 3, 4 it is rather easy to find some distances for the cases p = 2 and p = 3.   Table 1: This table contains 64 numbers presented by ordered digits 1 Table 2: Every number in this table is presented by two ways and connected by the sign of equality "=". On the left hand side of the equality is a number in base 5 presented by digits 1, 2, 3, 4. On the right hand side is the same number presented by product of its primes in decimal notation. These products of primes help us to easily find related p-adic norms. Note that all primes, except 5, between 2 and 61 are employed in this table.

Adelic aspects
Note that any of the above 64 numbers, as well as any rational number, has some real and p-adic properties, for all infinitely many primes. In mathematics there is way to treat these real and p-adic properties simultaneously. It is related to the notion of adeles and ideles. An adele α is an infinite sequence where for all but a finite set P of primes p one has that α p ∈ Z p = {x ∈ Q p : |x| p ≤ 1}, which is the ring of p-adic integers.
Here, it is sufficient to know what is a principal idele. Principal idele ρ id is an infinite sequence where all ρ ∞ , ρ 2 , ρ 3 , ρ 5 , ..., ρ p , ... are the same non-zero rational numbers, but treated by different norms -ordinary absolute value for subscript ∞ and p-adic norms denoted by subscripts p = 2, 3, 5, 7, 11, .... In our case, ρ is a natural number. One can show that the following formula |ρ| ∞ |ρ| 2 |ρ| 3 |ρ| 5 · · · |ρ| p · · · = 1 (13) is valid, where product runs over ordinary absolute value and all p-adic norms of the same natural (or non-zero rational) number. According to formula (13), all (real and p-adic) properties of any non-zero rational number (object) are mutually connected. In our example with 64 objects, we can consider them as 64 principal ideles. Ordinary absolute value and related usual distance can describe spatial properties of these objects. p-Adic norm and the corresponding distance can describe arbitrary many various properties. In particular, by p-adic distance one can investigate similarity (and dissimilarity) of some properties between different objects.
The most general mathematical notion for unification of real and p-adic numbers is adele, which takes into account field of rational numbers Q with all its non-trivial valuations and all corresponding completions (see, e.g. [10]). Artificial intelligence based on adeles, should be called adelic intelligence.

Concluding Remarks
In the previous sections we presented some basics of an ultrametric (p-adic) approach to language which could be used in design of an artificial intelligence. This p-adic approach to an artificial language gives possibility to quantify similarity between words.
As an illustration of ultrametric language, we considered 64 objects presented by 3-digit numbers in base 5 and endowed by p-adic properties. Number of these properties can be arbitrary and they are related to p-adic norm. Similarity of properties between distinct objects can be expressed by p-adic distance. Our example with 64 objects can be generalized to any larger number of words and longer sequences of letters. It is worth noting that these ultrametric spaces of sequences can be also considered as ultrametric networks, where nodes are sequences and links are p-adic distances between them.
To compare similarities quantitatively, it is useful to introduce relative similarity δ within an ultrametric space U in the following way: where D is maximal distance on space U. One can easily see that values of δ are: 0 ≤ δ ≤ 1. When x = y then δ = 1, and δ = 0 when d(x, y) = D. Thus, relative similarity increases from 0 to 1. This relative similarity can be particularly useful comparing similarities in an ultrametric space U 1 with similarities in another space U 2 . One can also introduce relative dissimilarityδ by formula δ +δ = 1.
For the future investigation of the subject proposed in this paper, we plan to construct a set of objects with appropriate set of natural numbers, and connect p-adic properties with some concrete characteristics of given objects.