一小段关键词分析代码(VB)
帮朋友改的一小段关键词分析代码; 含两个单词复合计数
Private Function CollectWords() As Dictionary(Of String, Integer)
'Create a new dictionary
Dim table As New Dictionary(Of String, Integer)
'Prompt for the user
Console.WriteLine(
"Enter a line : ")
'Get the user's input
Dim input As String = Console.ReadLine()
'Split the line and make an array of words
Dim words As String() = input.Split()
Dim wordPrev As String = ""
'Search the array
For Each word In words
'We can get the lowercase, not necessary here
Dim wordKey As String = word.ToLower()
'If the dictionay contains the words
If table.ContainsKey(wordKey) Then
'increment
table(wordKey) = table(wordKey) + 1
Else
'add a new word with a count of 1 in the dictionary
table.Add(wordKey, 1)
End If
Dim wordKey2 As String = (wordPrev + " " + word).ToLower()
If wordPrev <> "" Then
If table.ContainsKey(wordKey2) Then
'increment
table(wordKey2) = table(wordKey2) + 1
Else
'add a new word with a count of 1 in the dictionary
table.Add(wordKey2, 1)
End If
End If
wordPrev = word
Next
Return table
End Function
相关文档:
Option Explicit
Private Declare Function LoadCursor Lib "user32.dll" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Long) As Long
Private Declare Function SetCursor Lib "user32.dll" (ByVal hCursor As Long) As Long
Private Const IDC_HAND As Long = 32649
Private myHand_handle ......
由底至上是:
• 托管资源
• WMI 基础结构
• 使用者
托管资源
托管资源是任意逻辑或物理组件,通过使 ......
VB设计动画时钟
程序名:Sec-Time.vbp
程序类别:完整的VB程序
功能:显示一个动画时钟,该时针随着每一秒而动态变化。
程序说明
1.如何画时钟表盘上的所有直线元素?
用Load命令建立原始Line控制的14个拷贝(因为表盘有12个点和时、分、秒共15个Line),该控制数组每一个实例的端点坐标属性设置为每条线在时 ......
一。数据类型
Byte 1
字节 无符号
Interger 2
字节
Long 4
字节
Float 4
字节
Double 8
字节
String
Date
Boolean
Currency
Variant
2.
变长字符串和定长字符
系统默认初始值为空字符串;
变长字符串:di ......