how to calculate frequency of each letter for every characters individual in access database?

Beantwortet how to calculate frequency of each letter for every characters individual in access database?

  • Dienstag, 7. August 2012 00:42
     
     

    hi

    ihave database

    texttabe

    id

    texti need count

    how to calculate  frequency of each letter for every characters individual in  access database?

    Is there a solution to this problem?

    thanks

Alle Antworten

  • Dienstag, 7. August 2012 09:39
     
     

    Hello,

    There may be a solution, if the problem is well understood.

    I must say, I don't really understand your question.

    Please explain what is the structure of your table, the fields and their contents. Also please exlain what you are trying to achieve.

    When posting code, please use the "Insert Code Block" button.

  • Mittwoch, 8. August 2012 06:59
    Moderator
     
     Beantwortet

    Hi mooo sa,

    Welcome to the MSDN forum.

    Your issue is not clearly. And I’m just wondering the way to calculate the frequency? According to your description, the equation seems to be: the number of one specific letter contained Characters/total number of characters.

    So the solution is loading all the characters from Access database to DataTable. Loop the DataTable to count the number of characters and use string.contains method to calculate the characters contained specific letters at the same time.

    Here is some information about access to database and some method you will need to use:

    OleDbConnection Class: http://msdn.microsoft.com/en-us/library/system.data.oledb.oledbconnection.aspx

    string.contains method: http://msdn.microsoft.com/en-us/library/dy85x1sa.aspx

    Hope this helps.


    Mark Liu-lxf [MSFT]
    MSDN Community Support | Feedback to us

  • Mittwoch, 8. August 2012 21:20
     
     Beantwortet Enthält Code

    Once it is in some kind of text format, you can do something like this:

    This is a forms application with a button and a multiline textbox

    Code:

    Option Strict On
    Imports System.IO
    Imports System.Text.RegularExpressions
    Public Class Form1
        Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
            Dim AllChars As String = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
            Dim SR As StreamReader = New StreamReader("D:\Latin.txt")
            'NOTE : "D:\Latin.txt" was generated here - http://www.lipsum.com/
            Dim StringToCheck As String = SR.ReadToEnd()
            SR.Close()
            Dim StringToFind As String
            For Each Ch As Char In AllChars
                StringToFind = Ch
                Dim exp As New Regex(StringToFind)
                TextBox1.AppendText(Ch & " - " & exp.Matches(StringToCheck).Count.ToString & vbNewLine)
            Next
        End Sub
    End Class
    

  • Dienstag, 14. August 2012 09:33
    Moderator
     
     

    Hi mooo sa,

    We haven’t heard from you for several days. I’d like to mark the helpful replies as answer firstly. If you have any additional questions, you also can unmark the replay and post your question here. 

    Sorry for any inconvenience and have a nice day.


    Mark Liu-lxf [MSFT]
    MSDN Community Support | Feedback to us