-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add functions for tokenizing absolute and relative directory and file paths - Add tests
- Loading branch information
Showing
10 changed files
with
232 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
namespace ARCTokenization | ||
|
||
open ControlledVocabulary | ||
open FSharpAux | ||
open FsSpreadsheet | ||
open ARCTokenization.Terms | ||
open ARCTokenization.StructuralOntology | ||
|
||
open System.IO | ||
open System | ||
open ControlledVocabulary | ||
|
||
module internal FS = | ||
|
||
let tokenizeRelativeDirectoryPaths (rootPath:string) = | ||
let root = System.Uri(rootPath) | ||
seq { | ||
for dir in Directory.EnumerateDirectories(rootPath, "*", SearchOption.AllDirectories) do | ||
let currentUri = System.Uri(dir) | ||
yield CvParam( | ||
cvTerm = AFSO.``Directory Path``, | ||
v = root.MakeRelativeUri(currentUri).ToString() | ||
) | ||
} | ||
|
||
let tokenizeAbsoluteDirectoryPaths (rootPath:string) = | ||
seq { | ||
for dir in Directory.EnumerateDirectories(rootPath, "*", SearchOption.AllDirectories) do | ||
yield CvParam( | ||
cvTerm = AFSO.``Directory Path``, | ||
v = dir.Replace("\\","/") | ||
) | ||
} | ||
|
||
|
||
let tokenizeRelativeFilePaths (rootPath:string) = | ||
let root = System.Uri(rootPath) | ||
seq { | ||
for file in Directory.EnumerateFiles(rootPath, "*", SearchOption.AllDirectories) do | ||
let currentFileUri = System.Uri(file) | ||
yield CvParam( | ||
cvTerm = AFSO.``File Path``, | ||
v = root.MakeRelativeUri(currentFileUri).ToString() | ||
) | ||
} | ||
|
||
let tokenizeAbsoluteFilePaths (rootPath:string) = | ||
seq { | ||
for file in Directory.EnumerateFiles(rootPath, "*", SearchOption.AllDirectories) do | ||
yield CvParam( | ||
cvTerm = AFSO.``File Path``, | ||
v = file.Replace("\\","/") | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters