val parseScenes : sceneAcc:string list list -> characterAcc:string list -> items:string list -> string list list
Full name: index.parseScenes
val sceneAcc : string list list
val characterAcc : string list
val items : string list
type 'T list = List<'T>
Full name: Microsoft.FSharp.Collections.list<_>
val item : string
val rest : string list
active recognizer SceneTitle: string -> Choice<string,string,unit>
Full name: index.( |SceneTitle|Name|Word| )
val title : string
val fullScene : string list
Multiple items module List
from Microsoft.FSharp.Collections
-------------------- type List<'T> = | ( [] ) | ( :: ) of Head: 'T * Tail: 'T list interface IReadOnlyCollection<'T> interface IEnumerable interface IEnumerable<'T> member GetSlice : startIndex:int option * endIndex:int option -> 'T list member Head : 'T member IsEmpty : bool member Item : index:int -> 'T with get member Length : int member Tail : 'T list static member Cons : head:'T * tail:'T list -> 'T list static member Empty : 'T list
Full name: Microsoft.FSharp.Collections.List<_>
val rev : list:'T list -> 'T list
Full name: Microsoft.FSharp.Collections.List.rev
active recognizer Name: string -> Choice<string,string,unit>
Full name: index.( |SceneTitle|Name|Word| )
val name : string
active recognizer Word: string -> Choice<string,string,unit>
<pre>
...
<b> INT. MOS EISLEY SPACEPORT - DOCKING BAY 94 </b>
Chewbacca leads the group into a giant dirt pit that is
Docking Bay 94. Resting in the middle of the huge hole is a
large, round, beat-up, pieced-together hunk of junk that
could only loosely be called a starship.
<b> LUKE </b>
What a piece of junk.
The tall figure of Han Solo comes down the boarding ramp.
...
</pre>
Parsing scripts
Parsing with active patterns
1: 2: 3: 4: 5: 6: 7: 8:
let (|SceneTitle|Name|Word|) (text:string) =letscenePattern="[ 0-9]*(INT.|EXT.)[ A-Z0-9]"letnamePattern="^[/A-Z0-9]+[-]*[/A-Z0-9 ]*[-]*[/A-Z0-9 ]+$"ifRegex.Match(text, scenePattern).SuccessthenSceneTitletextelifRegex.Match(text, namePattern).SuccessthenNametextelseWord
Parsing scripts with pattern matching
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
letrecparseScenessceneAcccharacterAcc (items:stringlist) =matchitemswith
| item::rest->matchitemwith
| SceneTitletitle->// add the finished scene to the scene accumulatorletfullScene=List.revcharacterAccparseScenes (fullScene::sceneAcc) [] rest
| Namename->// add character's name to the character accumulatorparseScenessceneAcc (name::characterAcc) rest
| Word->// do nothingparseScenessceneAcccharacterAccrest
| [] ->List.revsceneAcc
\[K_v = \text{Number of neighbours of $v$} \\
E_v = \text{Number of links between neighbours of $v$} \\ \\
\text{Clustering}(v) = \frac{E_v}{\frac{1}{2} K_v (K_v - 1)}\]
Clustering coefficient
\[K_v = \text{Number of neighbours of $v$} \\
E_v = \text{Number of links between neighbours of $v$} \\ \\
\text{Clustering}(\text{network}) = \frac{1}{N} \sum_v \frac{E_v}{\frac{1}{2} K_v (K_v - 1)}\]
Clustering Coefficient
Degree
Degree
Degree
Degree
\[\text{Degree}(v) = \text{Number of links }v \leftrightarrow v' \\
v \neq v'\]
Betweenness
Betweenness
Betweenness
Betweenness
Betweenness
Betweenness
\[S_v = \text{Number of shortest paths between $a$ and $b$ through $v$} \\
S = \text{Number of shortest paths between $a$ and $b$} \\ \\
\text{Betweenness}(v)_{ab} = \frac{S_v}{S}\]
Betweenness
\[S_v = \text{Number of shortest paths between $a$ and $b$ through $v$} \\
S = \text{Number of shortest paths between $a$ and $b$} \\ \\
\text{Betweenness}(v) = \sum_{ab} \frac{S_v}{S}\]