Link Pattern

Something that DaveHarris knows about but doesn't explain in: TipsFromWardCunningham. Judging from the rest of this page, LinkPattern is just a synonym for WikiName.

For way too much on link patterns and wikis, see http://usemod.com/cgi-bin/mb.pl?LinkPattern and its backlinks.


I'm assuming it's the RegularExpression for pages in Wiki (anyone know different?).

\b([A-Z][a-z]+){2,}\b
-- AlanFrancis

I was thinking that it was a sub-pattern in the greater WikiWeb... like a knot... or pattern in the knot (thinking about the portion of the celtic knot pictured above). But after reading all about other folk's meaning of LinkPattern, maybe I was really thinking of something like a WikiKnot? [now called a CulDeSac]. -- MattSimpson

This is supposed to help beginners? The LinkPattern is, in its simplest form, a word containing more than one capital letter. The capitals shouldn't be right next to each other (and the final letter should not be a capital). That is, a word like TWiki is not a LinkPattern. CamelCase, in other words.

Other wikis sometimes have differences in their LinkPatterns (whether to allow digits or not, whether to allow TLAs - ThreeLetterAcronyms - to be links, etc.), and this wiki probably has subtleties that I'm not mentioning. This will get you started though. -- JeanJordaan

One of the subtleties is the use of SixSingleQuotes to make exceptions to what seem to be LinkPatterns (SuchAsThisExample, OrElseThisExample).

I'm new here, but I picked up on the proper use of WikiWords pretty quickly. Except for one problem. My naive assumptions about WikiWordsWhichContainAOneLetterWord was incorrect. So any WikiWord with the English words "a" or "I" in it doesn't work. Is there a standard solution? -- MichaelChermside

Yes: leave 'a' small; make 'I' big and the next letter small. e.g. AmIhappy; WhatIsaFish.


Dropped digits [0-9], based on original Wiki implementation, in HyperPerl (an example of LiterateProgramming). See...

  http://c2.com/w4/wikibase/wiki.cgi?PrintBodyText
Containing...
s/\b$LinkPattern\b/&AsAnchor($&)/geo;
  http://c2.com/w4/wikibase/wiki.cgi?LinkPattern
  http://c2.com/w4/wikibase/wiki.cgi?AsAnchor
-- JeffGrigg


How about matching each word against a dictionary of common words to eliminate the ones that don't need to be linked then use a separate dictionary of new and important words to set up the links you do want? The advantage is that the text is standard English.

-- JamesNewton


Is there a standard way to make a single word fit the link pattern? -- PatCallahan

Yes. Write two more specific words.

It's common to append a categorization to a single word. Examples: JavaLanguage, IshmaelBook.

It is possible to make a single word, like "Categorization" work in the same way as a WikiWord, by making the selectionFilter (in most cases a RegularExpression) include it. In modifying an interpreter of the WikiMarkupLanguage, this might be indicated in a number of ways, including bracketing [Categorization], doubleBracketing [[Categorization]], preceded by a backtick `Categorization followed by any space or other designedDelimiter(s). -- DonaldNoyes.200812062045.m06


It's interesting to look at the link pattern without worrying about the letters. Let 0 stand for a lowercase letter, and 1 for an uppercase letter. A wiki word like LinkPattern would have the bit pattern 10001000000. Here are the first few bit patterns:

    1010  - 10
   10010  - 18
   10100  - 20
  100010  - 34
  100100  - 36
  101000  - 40
  101010  - 42
 1000010  - 66
 1000100  - 68
 1001000  - 72
 1001010  - 74
 1010000  - 80
 1010010  - 82
 1010100  - 84

I propose that this sequence of numbers be called the Wiki Sequence: 10, 18, 20, 34, 36, ....

Another interesting sequence is found by looking at the number of different wiki bit strings of a given length. There are 0 of length 1 - 3, 1 of length 4, 2 of length 5, 4 of length 6, etc. Using a Prolog program, I generated the following values of the sequence: 0, 0, 0, 1, 2, 4, 7, 12, 20, 33, 54, 88, 143, 232.... This appears to be the FibonacciSequence minus 1 from each term! -- TobyDonaldson?

Technically, this is mathematically incorrect. If you take the FibonacciSequence and subtract one, you would get 0 0 -1 -2 -4 -7 because you would basically have f(f(n-1) + f(n-2) -1) [you want to keep it a series don't you?] More correct is to say that since the first length 1-3 are all 0 we treat that as a single number in the series at f(0) = 0 and move on. Then what you are really showing the bit string is the FibonacciSequence + 1...or f(f(n-1) + f(n-2) + 1) which gives you 0 1 2 4 7 12...exactly what you're looking for. Of course, this too doesn't help beginning Wiki users (of which I am one) or define the link pattern... but it is mathematically interesting. -- Mike

[There is a difference between subtracting one from each term and putting "-1" into the recurrence relation.]

Just allow the pattern 1 followed by one or more zeroes, and you obviously get zero followed by the actual FibonacciSequence, so the above hypothesis is correct except for the first value. I don't follow what you mean. Can you elaborate?

After some more thought, I think I can (rigorously!) prove how many wiki bit strings there are of length n. Here's recursive definition of a wiki bit string:

I think this is equivalent to the standard definitions of wiki (I sketched a proof, but it's a lot of case analysis, so I'll skip it). From this recursive definition, you can then fairly easily prove that the number of wiki bit strings of length n is W(n) where:

Basically, to get all the wiki bit strings of length n, you add 0 to the W(n-1) strings of length n - 1, you add 10 to the W(n - 2) strings of length n - 2, and you always get 1 n-length string of the base-case form 10+10.

If you calculate some values of W(n), you will see that from n = 4 onwards, they are indeed the FibonacciSequence minus 1.

You can convert the recursive definition into a recursive definition for ordinary wiki words. A string of uppercase and lowercase letters is a wiki word if and only if:

This doesn't seem like a very helpful definition for people, or even for programs, but it's interesting. Another useful recursive rule is that if u and v are wiki words, then uv is also a wiki word.

-- TobyDonaldson?



For the benefit of TobyDonaldson?...

   binary - decimal

1010 - 10

10010 - 18 10100 - 20

100010 - 34 100100 - 36 101000 - 40 101010 - 42

1000010 - 66 1000100 - 68 1001000 - 72 1001010 - 74 1010000 - 80 1010010 - 82 1010100 - 84

To a short group, one adds '10', and to the next group, one adds '0'. Hence each new group has as many items as in the previous two groups (plus one more in this instance since a 1 followed by zeroes only is not listed). If you start with two groups of length 1, you can get the Fibonacci sequence. If you don't, you get a closely related sequence. Or am I misunderstanding what puzzled you? -- VickiKerr

I get it now ... thanks! I eventually figured it out by formulating the recursive definition mentioned on LinkPattern. At heart, I guess I am formalist, and need to work through precise definitions before I feel I understand something like this. -- TobyDonaldson?

The sequence 10, 18, 20, 34, 36,... is closely related to a sequence dubbed "Fibbinary numbers" (which are obtained by halving all the values and including the powers of 2), but that terminology seems to be obscure. -- vk


The WikiSequence mentioned above deserves its own page, since it is not found at http://www.research.att.com/~njas/sequences/ -- ChrisGarrod


CategoryWiki


EditText of this page (last edited December 6, 2008) or FindPage with title or text search

Meatball   Wikibase